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.

28 lines
873 B

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/graphcore"
  7. "git.aiterp.net/stufflog/server/models"
  8. )
  9. func (r *activityResolver) UnitName(ctx context.Context, obj *models.Activity) (*string, error) {
  10. if !obj.Countable || obj.UnitIsTimeSpent {
  11. return nil, nil
  12. }
  13. return &obj.UnitName, nil
  14. }
  15. func (r *activityResolver) Project(ctx context.Context, obj *models.Activity) (*models.Project, error) {
  16. return r.Database.Projects().Find(ctx, obj.ProjectID)
  17. }
  18. // Activity returns graphcore.ActivityResolver implementation.
  19. func (r *Resolver) Activity() graphcore.ActivityResolver { return &activityResolver{r} }
  20. type activityResolver struct{ *Resolver }