2020-07-13 09:20:14 +02:00
|
|
|
package graph
|
|
|
|
|
|
|
|
// 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"
|
2020-07-21 18:10:03 +02:00
|
|
|
"strconv"
|
2020-07-13 14:44:05 +02:00
|
|
|
|
2020-07-13 09:20:14 +02:00
|
|
|
"forge.cadoles.com/Cadoles/daddy/internal/graph/generated"
|
2020-07-16 09:28:27 +02:00
|
|
|
model1 "forge.cadoles.com/Cadoles/daddy/internal/model"
|
2020-07-13 09:20:14 +02:00
|
|
|
)
|
|
|
|
|
2020-08-26 14:51:53 +02:00
|
|
|
func (r *decisionSupportFileResolver) ID(ctx context.Context, obj *model1.DecisionSupportFile) (string, error) {
|
|
|
|
return strconv.FormatUint(uint64(obj.ID), 10), nil
|
|
|
|
}
|
|
|
|
|
2020-10-02 16:37:24 +02:00
|
|
|
func (r *eventResolver) ID(ctx context.Context, obj *model1.Event) (string, error) {
|
|
|
|
return strconv.FormatUint(uint64(obj.ID), 10), nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *eventResolver) Type(ctx context.Context, obj *model1.Event) (string, error) {
|
|
|
|
return string(obj.Type), nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *eventResolver) ObjectID(ctx context.Context, obj *model1.Event) (string, error) {
|
|
|
|
return strconv.FormatUint(uint64(obj.ObjectID), 10), nil
|
2020-08-26 14:51:53 +02:00
|
|
|
}
|
|
|
|
|
2020-07-16 09:28:27 +02:00
|
|
|
func (r *queryResolver) UserProfile(ctx context.Context) (*model1.User, error) {
|
2020-07-13 14:55:32 +02:00
|
|
|
return handleUserProfile(ctx)
|
2020-07-13 09:20:14 +02:00
|
|
|
}
|
|
|
|
|
2020-07-22 22:25:03 +02:00
|
|
|
func (r *queryResolver) Workgroups(ctx context.Context, filter *model1.WorkgroupsFilter) ([]*model1.Workgroup, error) {
|
|
|
|
return handleWorkgroups(ctx, filter)
|
2020-07-21 18:10:03 +02:00
|
|
|
}
|
|
|
|
|
2020-08-26 14:51:53 +02:00
|
|
|
func (r *queryResolver) DecisionSupportFiles(ctx context.Context, filter *model1.DecisionSupportFileFilter) ([]*model1.DecisionSupportFile, error) {
|
|
|
|
return handleDecisionSupportFiles(ctx, filter)
|
|
|
|
}
|
|
|
|
|
2020-10-02 16:37:24 +02:00
|
|
|
func (r *queryResolver) Events(ctx context.Context, filter *model1.EventFilter) ([]*model1.Event, error) {
|
|
|
|
return handleEvents(ctx, filter)
|
|
|
|
}
|
|
|
|
|
2020-09-04 11:19:24 +02:00
|
|
|
func (r *queryResolver) IsAuthorized(ctx context.Context, action string, object model1.AuthorizationObject) (bool, error) {
|
|
|
|
return handleIsAuthorized(ctx, action, object)
|
|
|
|
}
|
|
|
|
|
2020-07-21 18:10:03 +02:00
|
|
|
func (r *userResolver) ID(ctx context.Context, obj *model1.User) (string, error) {
|
|
|
|
return strconv.FormatUint(uint64(obj.ID), 10), nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *workgroupResolver) ID(ctx context.Context, obj *model1.Workgroup) (string, error) {
|
|
|
|
return strconv.FormatUint(uint64(obj.ID), 10), nil
|
|
|
|
}
|
|
|
|
|
2020-08-26 14:51:53 +02:00
|
|
|
// DecisionSupportFile returns generated.DecisionSupportFileResolver implementation.
|
|
|
|
func (r *Resolver) DecisionSupportFile() generated.DecisionSupportFileResolver {
|
|
|
|
return &decisionSupportFileResolver{r}
|
|
|
|
}
|
|
|
|
|
2020-10-02 16:37:24 +02:00
|
|
|
// Event returns generated.EventResolver implementation.
|
|
|
|
func (r *Resolver) Event() generated.EventResolver { return &eventResolver{r} }
|
|
|
|
|
2020-07-13 09:20:14 +02:00
|
|
|
// Query returns generated.QueryResolver implementation.
|
|
|
|
func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }
|
|
|
|
|
2020-07-21 18:10:03 +02:00
|
|
|
// User returns generated.UserResolver implementation.
|
|
|
|
func (r *Resolver) User() generated.UserResolver { return &userResolver{r} }
|
|
|
|
|
|
|
|
// Workgroup returns generated.WorkgroupResolver implementation.
|
|
|
|
func (r *Resolver) Workgroup() generated.WorkgroupResolver { return &workgroupResolver{r} }
|
|
|
|
|
2020-08-26 14:51:53 +02:00
|
|
|
type decisionSupportFileResolver struct{ *Resolver }
|
2020-10-02 16:37:24 +02:00
|
|
|
type eventResolver struct{ *Resolver }
|
2020-07-13 09:20:14 +02:00
|
|
|
type queryResolver struct{ *Resolver }
|
2020-07-21 18:10:03 +02:00
|
|
|
type userResolver struct{ *Resolver }
|
|
|
|
type workgroupResolver struct{ *Resolver }
|
2020-10-02 16:37:24 +02:00
|
|
|
|
|
|
|
// !!! WARNING !!!
|
|
|
|
// The code below was going to be deleted when updating resolvers. It has been copied here so you have
|
|
|
|
// one last chance to move it out of harms way if you want. There are two reasons this happens:
|
|
|
|
// - When renaming or deleting a resolver the old code will be put in here. You can safely delete
|
|
|
|
// it when you're done.
|
|
|
|
// - You have helper methods in this file. Move them out to keep these resolver files clean.
|
|
|
|
func (r *decisionSupportFileResolver) Sections(ctx context.Context, obj *model1.DecisionSupportFile) (map[string]interface{}, error) {
|
|
|
|
return obj.Sections, nil
|
|
|
|
}
|