handle_graphql

package
v0.0.0-...-0deb35c Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2021 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

expose trello API/cards as model to be exposed by graphql

Index

Constants

View Source
const (
	// SummaryDir is where dumped data about tasks is written
	SummaryDir = "task-summary"
	// ReviewDir is where templates are written and updated by humans.
	ReviewDir = "reviews"
	// ReviewVisDir is where templates from ReviewDir are processed into human friendly documents
	ReviewVisDir = "visualized_reviews"
)

Variables

This section is empty.

Functions

func ForContext

func ForContext(ctx context.Context) *jwt.Claims

ForContext finds the user from the context. REQUIRES Middleware to have run.

func GetAuthID

func GetAuthID(next http.Handler) http.Handler

GetAuthID is middleware that gets authenticated claim if present and valid. This doesn't enforce authentication.

func MarshalTimestamp

func MarshalTimestamp(t time.Time) graphql.Marshaler

if the type referenced in .gqlgen.yml is a function that returns a marshaller we can use it to encode and decode onto any existing go type.

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

func UnmarshalTimestamp

func UnmarshalTimestamp(v interface{}) (time.Time, error)

Unmarshal{Typename} is only required if the scalar appears as an input. The raw values have already been decoded from json into int/float64/bool/nil/map[string]interface/[]interface

Types

type BoardList

type BoardList struct {
	Board string `json:"board"`
	List  string `json:"list"`
}

type BoardListInput

type BoardListInput struct {
	Board string `json:"board"`
	List  string `json:"list"`
}

type ComplexityRoot

type ComplexityRoot struct {
	BoardList struct {
		Board func(childComplexity int) int
		List  func(childComplexity int) int
	}

	FinishResult struct {
		Message func(childComplexity int) int
		Ok      func(childComplexity int) int
	}

	GenerateResult struct {
		Message func(childComplexity int) int
		Ok      func(childComplexity int) int
	}

	MonthlyGoal struct {
		IDCard      func(childComplexity int) int
		Title       func(childComplexity int) int
		WeeklyGoals func(childComplexity int) int
	}

	Mutation struct {
		PrepareWeeklyReview  func(childComplexity int, year *int, week *int) int
		FinishWeeklyReview   func(childComplexity int, year *int, week *int) int
		SetDueDate           func(childComplexity int, taskID string, due time.Time) int
		SetDone              func(childComplexity int, taskID string, done bool, status *string, titleComment *string, nextDue *time.Time) int
		MoveTaskToList       func(childComplexity int, taskID string, list BoardListInput) int
		StartTimer           func(childComplexity int, taskID string, checkitemID *string) int
		StopTimer            func(childComplexity int, timerID string) int
		AddComment           func(childComplexity int, taskID string, comment string) int
		SetGoalDone          func(childComplexity int, taskID string, checkitemID string, done bool, status *string) int
		AddTask              func(childComplexity int, title string, board *string, list *string) int
		AddWeeklyGoal        func(childComplexity int, taskID string, title string, week int) int
		AddMonthlyGoal       func(childComplexity int, title string) int
		PrepareMonthlyReview func(childComplexity int, year *int, month *int) int
		FinishMonthlyReview  func(childComplexity int, year *int, month *int) int
	}

	Query struct {
		Tasks                func(childComplexity int, dueBefore *int, inBoardList *BoardListInput) int
		WeeklyVisualization  func(childComplexity int, year *int, week *int) int
		MonthlyVisualization func(childComplexity int, year *int, month *int) int
		MonthlyGoals         func(childComplexity int) int
		ActiveTimer          func(childComplexity int) int
	}

	Task struct {
		ID               func(childComplexity int) int
		Title            func(childComplexity int) int
		CreatedDate      func(childComplexity int) int
		URL              func(childComplexity int) int
		Due              func(childComplexity int) int
		List             func(childComplexity int) int
		Period           func(childComplexity int) int
		DateLastActivity func(childComplexity int) int
		Desc             func(childComplexity int) int
		ChecklistItems   func(childComplexity int) int
	}

	Timer struct {
		ID    func(childComplexity int) int
		Title func(childComplexity int) int
	}

	WeeklyGoal struct {
		IDCard      func(childComplexity int) int
		IDCheckitem func(childComplexity int) int
		Title       func(childComplexity int) int
		Tasks       func(childComplexity int) int
		Year        func(childComplexity int) int
		Month       func(childComplexity int) int
		Week        func(childComplexity int) int
		Done        func(childComplexity int) int
		Status      func(childComplexity int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
}

type FinishResult

type FinishResult struct {
	Message *string `json:"message"`
	Ok      bool    `json:"ok"`
}

type GenerateResult

type GenerateResult struct {
	Message *string `json:"message"`
	Ok      bool    `json:"ok"`
}

type MonthlyGoal

type MonthlyGoal struct {
	IDCard string
	Title  string // `json:"title"`
	// contains filtered or unexported fields
}

func GetMonthlyGoals

func GetMonthlyGoals(cl *workflow.Client) (goals []MonthlyGoal, err error)

type MonthlyGoalResolver

type MonthlyGoalResolver interface {
	WeeklyGoals(ctx context.Context, obj *MonthlyGoal) ([]WeeklyGoal, error)
}

type MutationResolver

type MutationResolver interface {
	PrepareWeeklyReview(ctx context.Context, year *int, week *int) (*GenerateResult, error)
	FinishWeeklyReview(ctx context.Context, year *int, week *int) (*FinishResult, error)
	SetDueDate(ctx context.Context, taskID string, due time.Time) (*Task, error)
	SetDone(ctx context.Context, taskID string, done bool, status *string, titleComment *string, nextDue *time.Time) (*Task, error)
	MoveTaskToList(ctx context.Context, taskID string, list BoardListInput) (*Task, error)
	StartTimer(ctx context.Context, taskID string, checkitemID *string) (*Timer, error)
	StopTimer(ctx context.Context, timerID string) (*bool, error)
	AddComment(ctx context.Context, taskID string, comment string) (*Task, error)
	SetGoalDone(ctx context.Context, taskID string, checkitemID string, done bool, status *string) ([]MonthlyGoal, error)
	AddTask(ctx context.Context, title string, board *string, list *string) (*Task, error)
	AddWeeklyGoal(ctx context.Context, taskID string, title string, week int) ([]MonthlyGoal, error)
	AddMonthlyGoal(ctx context.Context, title string) ([]MonthlyGoal, error)
	PrepareMonthlyReview(ctx context.Context, year *int, month *int) (*GenerateResult, error)
	FinishMonthlyReview(ctx context.Context, year *int, month *int) (*FinishResult, error)
}

type QueryResolver

type QueryResolver interface {
	Tasks(ctx context.Context, dueBefore *int, inBoardList *BoardListInput) ([]Task, error)
	WeeklyVisualization(ctx context.Context, year *int, week *int) (*string, error)
	MonthlyVisualization(ctx context.Context, year *int, month *int) (*string, error)
	MonthlyGoals(ctx context.Context) ([]MonthlyGoal, error)
	ActiveTimer(ctx context.Context) (*Timer, error)
}

type Resolver

type Resolver struct{}

func (*Resolver) MonthlyGoal

func (r *Resolver) MonthlyGoal() MonthlyGoalResolver

func (*Resolver) Mutation

func (r *Resolver) Mutation() MutationResolver

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

type ResolverRoot

type ResolverRoot interface {
	MonthlyGoal() MonthlyGoalResolver
	Mutation() MutationResolver
	Query() QueryResolver
}

type Task

type Task struct {
	ID               string     `json:"id"`
	Title            string     `json:"title"`
	CreatedDate      *time.Time `json:"createdDate"`
	URL              *string    `json:"url"`
	Due              *time.Time `json:"due"`
	List             *BoardList `json:"list"`
	Period           *string    `json:"period"`
	DateLastActivity *time.Time `json:"dateLastActivity"`
	Desc             string     `json:"desc"`
	ChecklistItems   []string   `json:"checklistItems"`
}

func AddComment

func AddComment(taskID string, comment string) (*Task, error)

AddComment adds comment to card

func GetTasks

func GetTasks(cl *workflow.Client,
	boardlist *BoardListInput,
) (tasks []Task, err error)

func SetTaskDone

func SetTaskDone(taskID string, done bool, titleComment *string) (*Task, error)

SetTaskDone moves task to done this week list or back to inbox (depending on done) and optionally prepends a title comment

func SetTaskDue

func SetTaskDue(taskID string, due time.Time) (*Task, error)

func TaskFor

func TaskFor(card *trello.Card) (*Task, error)

type Timer

type Timer struct {
	ID    string `json:"id"`
	Title string `json:"title"`
}

func TimeEntryToTimer

func TimeEntryToTimer(te *gttimeentry.TimeEntry) (*Timer, error)

type WeeklyGoal

type WeeklyGoal struct {
	IDCard      string  `json:"idCard"`
	IDCheckitem string  `json:"idCheckitem"`
	Title       string  `json:"title"`
	Tasks       []*Task `json:"tasks"`
	Year        *int    `json:"year"`
	Month       *int    `json:"month"`
	Week        *int    `json:"week"`
	Done        *bool   `json:"done"`
	Status      *string `json:"status"`
}

func MonthlyGoalToWeeklyGoals

func MonthlyGoalToWeeklyGoals(mg *MonthlyGoal) []WeeklyGoal

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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