graphql

package
v0.0.0-...-349e90a Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: GPL-3.0 Imports: 18 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 {
	AuthData struct {
		Token func(childComplexity int) int
		User  func(childComplexity int) int
	}

	Group struct {
		Description func(childComplexity int) int
		Habits      func(childComplexity int) int
		ID          func(childComplexity int) int
		Name        func(childComplexity int) int
		User        func(childComplexity int) int
	}

	Habit struct {
		Description func(childComplexity int) int
		Group       func(childComplexity int) int
		ID          func(childComplexity int) int
		Name        func(childComplexity int) int
		Schedule    func(childComplexity int) int
		Successes   func(childComplexity int) int
		User        func(childComplexity int) int
	}

	Mutation struct {
		CreateGroup   func(childComplexity int, input models.NewGroup) int
		CreateHabit   func(childComplexity int, input models.NewHabit) int
		CreateSuccess func(childComplexity int, input models.NewSuccess) int
		DeleteGroup   func(childComplexity int, id string) int
		DeleteHabit   func(childComplexity int, id string) int
		DeleteSuccess func(childComplexity int, id string) int
		Login         func(childComplexity int, input models.Credentials) int
		RefreshToken  func(childComplexity int) int
		Register      func(childComplexity int, input models.Credentials) int
		UpdateGroup   func(childComplexity int, input models.GroupData) int
		UpdateHabit   func(childComplexity int, input models.HabitData) int
	}

	Query struct {
		GetCurrentUser func(childComplexity int) int
		GetGroup       func(childComplexity int, id string) int
		GetGroups      func(childComplexity int) int
		GetHabit       func(childComplexity int, id string) int
		GetHabits      func(childComplexity int, groupID *string, startDate *time.Time, endDate *time.Time, succeeded *bool) int
	}

	Schedule struct {
		Monthdays    func(childComplexity int) int
		PeriodInDays func(childComplexity int) int
		Start        func(childComplexity int) int
		Type         func(childComplexity int) int
		Weekdays     func(childComplexity int) int
	}

	Success struct {
		Date  func(childComplexity int) int
		Habit func(childComplexity int) int
		ID    func(childComplexity int) int
	}

	User struct {
		Email    func(childComplexity int) int
		Groups   func(childComplexity int) int
		Habits   func(childComplexity int) int
		ID       func(childComplexity int) int
		Name     func(childComplexity int) int
		Password func(childComplexity int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
}

type GroupResolver

type GroupResolver interface {
	ID(ctx context.Context, obj *models.Group) (string, error)

	Habits(ctx context.Context, obj *models.Group) ([]*models.Habit, error)
	User(ctx context.Context, obj *models.Group) (*models.User, error)
}

type HabitResolver

type HabitResolver interface {
	ID(ctx context.Context, obj *models.Habit) (string, error)

	Successes(ctx context.Context, obj *models.Habit) ([]*models.Success, error)
	Group(ctx context.Context, obj *models.Habit) (*models.Group, error)
	User(ctx context.Context, obj *models.Habit) (*models.User, error)
}

type MutationResolver

type MutationResolver interface {
	Register(ctx context.Context, input models.Credentials) (*models.AuthData, error)
	Login(ctx context.Context, input models.Credentials) (*models.AuthData, error)
	RefreshToken(ctx context.Context) (*models.AuthData, error)
	CreateGroup(ctx context.Context, input models.NewGroup) (*models.Group, error)
	UpdateGroup(ctx context.Context, input models.GroupData) (*models.Group, error)
	DeleteGroup(ctx context.Context, id string) (*models.Group, error)
	CreateHabit(ctx context.Context, input models.NewHabit) (*models.Habit, error)
	UpdateHabit(ctx context.Context, input models.HabitData) (*models.Habit, error)
	DeleteHabit(ctx context.Context, id string) (*models.Habit, error)
	CreateSuccess(ctx context.Context, input models.NewSuccess) (*models.Success, error)
	DeleteSuccess(ctx context.Context, id string) (*models.Success, error)
}

type QueryResolver

type QueryResolver interface {
	GetCurrentUser(ctx context.Context) (*models.User, error)
	GetGroups(ctx context.Context) ([]*models.Group, error)
	GetGroup(ctx context.Context, id string) (*models.Group, error)
	GetHabits(ctx context.Context, groupID *string, startDate *time.Time, endDate *time.Time, succeeded *bool) ([]*models.Habit, error)
	GetHabit(ctx context.Context, id string) (*models.Habit, error)
}

type Resolver

type Resolver struct {
	Database mongodb.DatabaseWrapper
}

func (*Resolver) Group

func (r *Resolver) Group() GroupResolver

func (*Resolver) Habit

func (r *Resolver) Habit() HabitResolver

func (*Resolver) Mutation

func (r *Resolver) Mutation() MutationResolver

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

func (*Resolver) Success

func (r *Resolver) Success() SuccessResolver

func (*Resolver) User

func (r *Resolver) User() UserResolver

type ResolverRoot

type ResolverRoot interface {
	Group() GroupResolver
	Habit() HabitResolver
	Mutation() MutationResolver
	Query() QueryResolver
	Success() SuccessResolver
	User() UserResolver
}

type SuccessResolver

type SuccessResolver interface {
	ID(ctx context.Context, obj *models.Success) (string, error)

	Habit(ctx context.Context, obj *models.Success) (*models.Habit, error)
}

type UserResolver

type UserResolver interface {
	ID(ctx context.Context, obj *models.User) (string, error)

	Groups(ctx context.Context, obj *models.User) ([]*models.Group, error)
	Habits(ctx context.Context, obj *models.User) ([]*models.Habit, error)
}

Jump to

Keyboard shortcuts

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