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
28 lines
873 B
package resolvers
|
|
|
|
// This file will be automatically regenerated based on the schema, any resolver implementations
|
|
// will be copied through when generating and any unknown code will be moved to the end.
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.aiterp.net/stufflog/server/graph/graphcore"
|
|
"git.aiterp.net/stufflog/server/models"
|
|
)
|
|
|
|
func (r *activityResolver) UnitName(ctx context.Context, obj *models.Activity) (*string, error) {
|
|
if !obj.Countable || obj.UnitIsTimeSpent {
|
|
return nil, nil
|
|
}
|
|
|
|
return &obj.UnitName, nil
|
|
}
|
|
|
|
func (r *activityResolver) Project(ctx context.Context, obj *models.Activity) (*models.Project, error) {
|
|
return r.Database.Projects().Find(ctx, obj.ProjectID)
|
|
}
|
|
|
|
// Activity returns graphcore.ActivityResolver implementation.
|
|
func (r *Resolver) Activity() graphcore.ActivityResolver { return &activityResolver{r} }
|
|
|
|
type activityResolver struct{ *Resolver }
|