graph

package
v0.0.0-...-efa6b18 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

YetAnotherToDoList Copyright © 2023 gilex-dev gilex-dev@proton.me

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

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 {
	Mutation struct {
		AddUserRole        func(childComplexity int, userID string, roleID string, userIsRoleManager bool) int
		CreateRefreshToken func(childComplexity int, input model.NewRefreshToken) int
		CreateRole         func(childComplexity int, input model.NewRole) int
		CreateTodo         func(childComplexity int, input model.NewTodo) int
		CreateUser         func(childComplexity int, input model.NewUser) int
		DeleteRefreshToken func(childComplexity int, id string) int
		DeleteRole         func(childComplexity int, id string) int
		DeleteTodo         func(childComplexity int, id string) int
		DeleteUser         func(childComplexity int, id string) int
		RemoveUserRole     func(childComplexity int, userID string, roleID string) int
		UpdateRefreshToken func(childComplexity int, id string, changes model.UpdateRefreshToken) int
		UpdateRole         func(childComplexity int, id string, changes model.UpdateRole) int
		UpdateTodo         func(childComplexity int, id string, changes model.UpdateTodo) int
		UpdateUser         func(childComplexity int, id string, changes model.UpdateUser) int
		UpdateUserRole     func(childComplexity int, userID string, roleID string, userIsRoleManager bool) int
	}

	Query struct {
		RefreshToken  func(childComplexity int, id string) int
		RefreshTokens func(childComplexity int) int
		Role          func(childComplexity int, id string) int
		Roles         func(childComplexity int) int
		Todo          func(childComplexity int, id string) int
		Todos         func(childComplexity int) int
		User          func(childComplexity int, id string) int
		Users         func(childComplexity int) int
	}

	RefreshToken struct {
		ExpiryDate func(childComplexity int) int
		ID         func(childComplexity int) int
		Selector   func(childComplexity int) int
		Token      func(childComplexity int) int
		TokenName  func(childComplexity int) int
		UserID     func(childComplexity int) int
	}

	RelationRoleUser struct {
		User              func(childComplexity int) int
		UserIsRoleManager func(childComplexity int) int
	}

	RelationUserRole struct {
		Role              func(childComplexity int) int
		UserIsRoleManager func(childComplexity int) int
	}

	Role struct {
		ID            func(childComplexity int) int
		IsAdmin       func(childComplexity int) int
		IsUserCreator func(childComplexity int) int
		RoleMembers   func(childComplexity int) int
		RoleName      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 {
		FullName func(childComplexity int) int
		ID       func(childComplexity int) int
		Roles    func(childComplexity int) int
		Todos    func(childComplexity int) int
		UserName func(childComplexity int) int
	}
}

type Config

type Config struct {
	Schema     *ast.Schema
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
	AsUser       func(ctx context.Context, obj interface{}, next graphql.Resolver, id string) (res interface{}, err error)
	HasPrivilege func(ctx context.Context, obj interface{}, next graphql.Resolver, privilege model.Privilege) (res interface{}, err error)
}

type MutationResolver

type MutationResolver interface {
	CreateUser(ctx context.Context, input model.NewUser) (*model.User, error)
	CreateTodo(ctx context.Context, input model.NewTodo) (*model.Todo, error)
	CreateRole(ctx context.Context, input model.NewRole) (*model.Role, error)
	CreateRefreshToken(ctx context.Context, input model.NewRefreshToken) (*model.RefreshToken, error)
	UpdateTodo(ctx context.Context, id string, changes model.UpdateTodo) (*model.Todo, error)
	UpdateUser(ctx context.Context, id string, changes model.UpdateUser) (*model.User, error)
	UpdateRole(ctx context.Context, id string, changes model.UpdateRole) (*model.Role, error)
	UpdateRefreshToken(ctx context.Context, id string, changes model.UpdateRefreshToken) (*model.RefreshToken, error)
	DeleteUser(ctx context.Context, id string) (*string, error)
	DeleteTodo(ctx context.Context, id string) (*string, error)
	DeleteRole(ctx context.Context, id string) (*string, error)
	DeleteRefreshToken(ctx context.Context, id string) (*string, error)
	AddUserRole(ctx context.Context, userID string, roleID string, userIsRoleManager bool) ([]*model.RelationUserRole, error)
	UpdateUserRole(ctx context.Context, userID string, roleID string, userIsRoleManager bool) ([]*model.RelationUserRole, error)
	RemoveUserRole(ctx context.Context, userID string, roleID string) ([]*model.RelationUserRole, error)
}

type QueryResolver

type QueryResolver interface {
	Todos(ctx context.Context) ([]*model.Todo, error)
	Users(ctx context.Context) ([]*model.User, error)
	Roles(ctx context.Context) ([]*model.Role, error)
	RefreshTokens(ctx context.Context) ([]*model.RefreshToken, error)
	User(ctx context.Context, id string) (*model.User, error)
	Todo(ctx context.Context, id string) (*model.Todo, error)
	Role(ctx context.Context, id string) (*model.Role, error)
	RefreshToken(ctx context.Context, id string) (*model.RefreshToken, error)
}

type Resolver

type Resolver struct {
}

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) Role

func (r *Resolver) Role() RoleResolver

Role returns RoleResolver 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 {
	Mutation() MutationResolver
	Query() QueryResolver
	Role() RoleResolver
	Todo() TodoResolver
	User() UserResolver
}

type RoleResolver

type RoleResolver interface {
	RoleMembers(ctx context.Context, obj *model.Role) ([]*model.RelationRoleUser, error)
}

type TodoResolver

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

type UserResolver

type UserResolver interface {
	Todos(ctx context.Context, obj *model.User) ([]*model.Todo, error)
	Roles(ctx context.Context, obj *model.User) ([]*model.RelationUserRole, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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