stufflog graphql server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.7 KiB

5 years ago
5 years ago
5 years ago
5 years ago
  1. package resolvers
  2. // This file will be automatically regenerated based on the schema, any resolver implementations
  3. // will be copied through when generating and any unknown code will be moved to the end.
  4. import (
  5. "context"
  6. "git.aiterp.net/stufflog/server/graph/loaders"
  7. "git.aiterp.net/stufflog/server/graph/graphcore"
  8. "git.aiterp.net/stufflog/server/models"
  9. )
  10. func (r *logResolver) User(ctx context.Context, obj *models.Log) (*models.User, error) {
  11. return r.Database.Users().Find(ctx, obj.UserID)
  12. }
  13. func (r *logItemResolver) Issue(ctx context.Context, obj *models.LogItem) (*models.Issue, error) {
  14. return loaders.IssueLoaderFromContext(ctx).Load(obj.IssueID)
  15. }
  16. func (r *logItemResolver) Item(ctx context.Context, obj *models.LogItem) (*models.IssueItem, error) {
  17. return r.Database.IssueItems().Find(ctx, obj.IssueItemID)
  18. }
  19. func (r *logTaskResolver) Issue(ctx context.Context, obj *models.LogTask) (*models.Issue, error) {
  20. return loaders.IssueLoaderFromContext(ctx).Load(obj.IssueID)
  21. }
  22. func (r *logTaskResolver) Task(ctx context.Context, obj *models.LogTask) (*models.IssueTask, error) {
  23. return r.Database.IssueTasks().Find(ctx, obj.IssueTaskID)
  24. }
  25. // Log returns graphcore.LogResolver implementation.
  26. func (r *Resolver) Log() graphcore.LogResolver { return &logResolver{r} }
  27. // LogItem returns graphcore.LogItemResolver implementation.
  28. func (r *Resolver) LogItem() graphcore.LogItemResolver { return &logItemResolver{r} }
  29. // LogTask returns graphcore.LogTaskResolver implementation.
  30. func (r *Resolver) LogTask() graphcore.LogTaskResolver { return &logTaskResolver{r} }
  31. type logResolver struct{ *Resolver }
  32. type logItemResolver struct{ *Resolver }
  33. type logTaskResolver struct{ *Resolver }