resolver

package
v0.0.0-...-52a3571 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

Types

type ComplexityRoot

type ComplexityRoot struct {
	Announcement struct {
		Author       func(childComplexity int) int
		Content      func(childComplexity int) int
		CreatedTime  func(childComplexity int) int
		ID           func(childComplexity int) int
		ModifiedTime func(childComplexity int) int
		Team         func(childComplexity int) int
		Title        func(childComplexity int) int
	}

	Invitation struct {
		ID      func(childComplexity int) int
		Invitee func(childComplexity int) int
		Inviter func(childComplexity int) int
		TeamID  func(childComplexity int) int
	}

	JudgeRecord struct {
		FinishedTime func(childComplexity int) int
		ID           func(childComplexity int) int
		JudgeTime    func(childComplexity int) int
		MemoryCost   func(childComplexity int) int
		Status       func(childComplexity int) int
		TimeCost     func(childComplexity int) int
		User         func(childComplexity int) int
	}

	JudgeReply struct {
		FinishedTime func(childComplexity int) int
		ID           func(childComplexity int) int
		JudgeTime    func(childComplexity int) int
		MemoryCost   func(childComplexity int) int
		Status       func(childComplexity int) int
		TimeCost     func(childComplexity int) int
		User         func(childComplexity int) int
	}

	JudgeRequest struct {
		CreatedTime func(childComplexity int) int
		ID          func(childComplexity int) int
		Problem     func(childComplexity int) int
		SourceCode  func(childComplexity int) int
		User        func(childComplexity int) int
	}

	Mutation struct {
		AcceptInvitation   func(childComplexity int, userID int64, teamID int64) int
		AddMembers         func(childComplexity int, teamID int64, members []int64) int
		AddProblem         func(childComplexity int, problem model.ProblemInput) int
		AddTeam            func(childComplexity int, team model.TeamInput) int
		BatchCreateUser    func(childComplexity int, users []*model.UserInput) int
		CreateAnnouncement func(childComplexity int, announcementInput model.AnnouncementInput) int
		CreateTodo         func(childComplexity int, payload *string) int
		CreateUser         func(childComplexity int, user model.UserInput) int
		DeleteAnnouncement func(childComplexity int, announcementID int64) int
		DeleteProblem      func(childComplexity int, problemID int64) int
		DeleteUser         func(childComplexity int, userID int64) int
		InviteUser         func(childComplexity int, userID int64, teamID int64) int
		KickMembers        func(childComplexity int, teamID int64, members []int64) int
		ModifyProblem      func(childComplexity int, problem model.ProblemInputWithID) int
		PermitJoinTeam     func(childComplexity int, userID int64, teamID int64) int
		Ping               func(childComplexity int, payload model.PingInput) int
		PingAuth           func(childComplexity int, payload model.PingInput) int
		QuitTeam           func(childComplexity int, userID int64, teamID int64) int
		RemoveAdmins       func(childComplexity int, teamID int64, admins []int64) int
		RequestJoinTeam    func(childComplexity int, userID int64, teamID int64) int
		SetAdmins          func(childComplexity int, teamID int64, admins []int64) int
		SetPrivate         func(childComplexity int, private bool, teamID int64) int
		SetTeamAdmin       func(childComplexity int, userID int64, teamID int64) int
		StarProblem        func(childComplexity int, problemID int64) int
		SubmitProblem      func(childComplexity int, judgeRequest model.JudgeRequestInput) int
		UnstarProblem      func(childComplexity int, problemID int64) int
		UpdateAnnouncement func(childComplexity int, announcementInput model.AnnouncementInputWithID) int
		UpdateJudgeRecord  func(childComplexity int, recordID int64) int
		UpdateTeam         func(childComplexity int, team model.TeamInputWithID) int
		UpdateUser         func(childComplexity int, user model.UserInput) int
	}

	Privilege struct {
		ID   func(childComplexity int) int
		Name func(childComplexity int) int
	}

	Problem struct {
		Author      func(childComplexity int) int
		Content     func(childComplexity int) int
		CreatedTime func(childComplexity int) int
		ID          func(childComplexity int) int
		SolvedBy    func(childComplexity int) int
		Tags        func(childComplexity int) int
		Title       func(childComplexity int) int
	}

	Query struct {
		CurrentUser                   func(childComplexity int, id int64) int
		GetAllProblems                func(childComplexity int) int
		GetAnnouncements              func(childComplexity int, userID int64) int
		GetAvailableTeams             func(childComplexity int) int
		GetLastRecordByUserAndProblem func(childComplexity int, problemID int64, userID int64) int
		GetProblemsWithFilter         func(childComplexity int, filter *model.ProblemFilter) int
		GetRecordsByProblem           func(childComplexity int, problemID int64) int
		GetRecordsByUser              func(childComplexity int, userID int64) int
		GetTeamByID                   func(childComplexity int, teamID int64) int
		GetTeamByName                 func(childComplexity int, teamName string) int
		TeamMembers                   func(childComplexity int, teamID int64) int
		Todos                         func(childComplexity int) int
		Users                         func(childComplexity int) int
	}

	Reply struct {
		Code    func(childComplexity int) int
		Data    func(childComplexity int) int
		Message func(childComplexity int) int
	}

	Role struct {
		ID         func(childComplexity int) int
		Name       func(childComplexity int) int
		Privileges func(childComplexity int) int
		Scope      func(childComplexity int) int
	}

	Tag struct {
		ID       func(childComplexity int) int
		Name     func(childComplexity int) int
		Problems func(childComplexity int) int
	}

	Task struct {
		Assignees  func(childComplexity int) int
		Content    func(childComplexity int) int
		ID         func(childComplexity int) int
		Name       func(childComplexity int) int
		ParentList func(childComplexity int) int
		Status     func(childComplexity int) int
		TaskType   func(childComplexity int) int
	}

	TaskList struct {
		Assignees    func(childComplexity int) int
		Deadline     func(childComplexity int) int
		ID           func(childComplexity int) int
		Name         func(childComplexity int) int
		RelyTaskList func(childComplexity int) int
		Status       func(childComplexity int) int
		Tasks        func(childComplexity int) int
	}

	Team struct {
		Admins        func(childComplexity int) int
		Announcements func(childComplexity int) int
		CreatedTime   func(childComplexity int) int
		Creator       func(childComplexity int) int
		Description   func(childComplexity int) int
		ID            func(childComplexity int) int
		Members       func(childComplexity int) int
		Name          func(childComplexity int) int
		Private       func(childComplexity int) int
	}

	Todo struct {
		Done func(childComplexity int) int
		ID   func(childComplexity int) int
		Text func(childComplexity int) int
		User func(childComplexity int) int
	}

	User struct {
		Announcements   func(childComplexity int) int
		Avatar          func(childComplexity int) int
		CreatedProblems func(childComplexity int) int
		CreatedTime     func(childComplexity int) int
		Email           func(childComplexity int) int
		ID              func(childComplexity int) int
		Managed         func(childComplexity int) int
		Nickname        func(childComplexity int) int
		Owned           func(childComplexity int) int
		Password        func(childComplexity int) int
		Records         func(childComplexity int) int
		SolvedProblems  func(childComplexity int) int
		Teams           func(childComplexity int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
	HasRole          func(ctx context.Context, obj interface{}, next graphql.Resolver, role model.RoleType, id *int64) (res interface{}, err error)
	TaskListFinished func(ctx context.Context, obj interface{}, next graphql.Resolver) (res interface{}, err error)
}

type JudgeRecordResolver

type JudgeRecordResolver interface {
	User(ctx context.Context, obj *ent.JudgeRecord) (*ent.User, error)
}

type MutationResolver

type MutationResolver interface {
	CreateTodo(ctx context.Context, payload *string) (*ent.Todo, error)
	CreateAnnouncement(ctx context.Context, announcementInput model.AnnouncementInput) (*ent.Announcement, error)
	UpdateAnnouncement(ctx context.Context, announcementInput model.AnnouncementInputWithID) (*ent.Announcement, error)
	DeleteAnnouncement(ctx context.Context, announcementID int64) (*model.Reply, error)
	UpdateJudgeRecord(ctx context.Context, recordID int64) (*ent.JudgeRecord, error)
	AddProblem(ctx context.Context, problem model.ProblemInput) (*ent.Problem, error)
	ModifyProblem(ctx context.Context, problem model.ProblemInputWithID) (*ent.Problem, error)
	DeleteProblem(ctx context.Context, problemID int64) (*model.Reply, error)
	AddTeam(ctx context.Context, team model.TeamInput) (*ent.Team, error)
	UpdateTeam(ctx context.Context, team model.TeamInputWithID) (*ent.Team, error)
	SetPrivate(ctx context.Context, private bool, teamID int64) (*ent.Team, error)
	SetAdmins(ctx context.Context, teamID int64, admins []int64) (*model.Reply, error)
	RemoveAdmins(ctx context.Context, teamID int64, admins []int64) (*model.Reply, error)
	AddMembers(ctx context.Context, teamID int64, members []int64) (*model.Reply, error)
	KickMembers(ctx context.Context, teamID int64, members []int64) (*model.Reply, error)
	CreateUser(ctx context.Context, user model.UserInput) (*ent.User, error)
	BatchCreateUser(ctx context.Context, users []*model.UserInput) (*model.Reply, error)
	UpdateUser(ctx context.Context, user model.UserInput) (*ent.User, error)
	DeleteUser(ctx context.Context, userID int64) (*model.Reply, error)
	RequestJoinTeam(ctx context.Context, userID int64, teamID int64) (*ent.User, error)
	PermitJoinTeam(ctx context.Context, userID int64, teamID int64) (*ent.User, error)
	QuitTeam(ctx context.Context, userID int64, teamID int64) (*ent.User, error)
	SetTeamAdmin(ctx context.Context, userID int64, teamID int64) (*model.Reply, error)
	InviteUser(ctx context.Context, userID int64, teamID int64) (*model.Reply, error)
	AcceptInvitation(ctx context.Context, userID int64, teamID int64) (*model.Reply, error)
	SubmitProblem(ctx context.Context, judgeRequest model.JudgeRequestInput) (*ent.JudgeRecord, error)
	StarProblem(ctx context.Context, problemID int64) (*model.Reply, error)
	UnstarProblem(ctx context.Context, problemID int64) (*model.Reply, error)
	Ping(ctx context.Context, payload model.PingInput) (*string, error)
	PingAuth(ctx context.Context, payload model.PingInput) (*string, error)
}

type QueryResolver

type QueryResolver interface {
	Todos(ctx context.Context) ([]*ent.Todo, error)
	GetAnnouncements(ctx context.Context, userID int64) ([]*ent.Announcement, error)
	GetRecordsByProblem(ctx context.Context, problemID int64) ([]*ent.JudgeRecord, error)
	GetRecordsByUser(ctx context.Context, userID int64) ([]*ent.JudgeRecord, error)
	GetLastRecordByUserAndProblem(ctx context.Context, problemID int64, userID int64) (*ent.JudgeRecord, error)
	GetAllProblems(ctx context.Context) ([]*ent.Problem, error)
	GetProblemsWithFilter(ctx context.Context, filter *model.ProblemFilter) ([]*ent.Problem, error)
	GetTeamByName(ctx context.Context, teamName string) (*ent.Team, error)
	GetTeamByID(ctx context.Context, teamID int64) (*ent.Team, error)
	GetAvailableTeams(ctx context.Context) ([]*ent.Team, error)
	TeamMembers(ctx context.Context, teamID int64) ([]*ent.User, error)
	CurrentUser(ctx context.Context, id int64) (*ent.User, error)
	Users(ctx context.Context) ([]*ent.User, error)
}

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

func NewResolver

func NewResolver(client *ent.Client) *Resolver

NewResolver create a resolver with client

func (*Resolver) JudgeRecord

func (r *Resolver) JudgeRecord() JudgeRecordResolver

JudgeRecord returns JudgeRecordResolver implementation.

func (*Resolver) Mutation

func (r *Resolver) Mutation() MutationResolver

Mutation returns MutationResolver implementation.

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

Query returns QueryResolver implementation.

func (*Resolver) Team

func (r *Resolver) Team() TeamResolver

Team returns TeamResolver implementation.

func (*Resolver) Todo

func (r *Resolver) Todo() TodoResolver

Todo returns TodoResolver implementation.

func (*Resolver) User

func (r *Resolver) User() UserResolver

User returns UserResolver implementation.

type ResolverRoot

type ResolverRoot interface {
	JudgeRecord() JudgeRecordResolver
	Mutation() MutationResolver
	Query() QueryResolver
	Team() TeamResolver
	Todo() TodoResolver
	User() UserResolver
}

type TeamResolver

type TeamResolver interface {
	Description(ctx context.Context, obj *ent.Team) (string, error)
}

type TodoResolver

type TodoResolver interface {
	User(ctx context.Context, obj *ent.Todo) (*ent.User, error)
}

type UserResolver

type UserResolver interface {
	Announcements(ctx context.Context, obj *ent.User) ([]*ent.Announcement, error)
	Records(ctx context.Context, obj *ent.User) ([]*ent.JudgeRecord, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL