diff options
author | Michael Muré <batolettre@gmail.com> | 2020-02-09 20:08:12 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-02-09 20:23:38 +0100 |
commit | b3d3612393387c83fa43f908dbb8e2a71068c834 (patch) | |
tree | e4609e21dc74e535d45b38cd7d0504681c544160 /graphql/resolvers/operations.go | |
parent | dca85b309a0a82e9993a345964d0831ab2876fb4 (diff) | |
parent | 3caffeef4d2ed25d4eb5d4bfd262f4fc3b92561f (diff) | |
download | git-bug-b3d3612393387c83fa43f908dbb8e2a71068c834.tar.gz |
Merge remote-tracking branch 'origin/master' into cheshirekow-jira
Diffstat (limited to 'graphql/resolvers/operations.go')
-rw-r--r-- | graphql/resolvers/operations.go | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/graphql/resolvers/operations.go b/graphql/resolvers/operations.go index ec803c1f..29110cf3 100644 --- a/graphql/resolvers/operations.go +++ b/graphql/resolvers/operations.go @@ -14,11 +14,15 @@ var _ graph.CreateOperationResolver = createOperationResolver{} type createOperationResolver struct{} -func (createOperationResolver) ID(ctx context.Context, obj *bug.CreateOperation) (string, error) { +func (createOperationResolver) ID(_ context.Context, obj *bug.CreateOperation) (string, error) { return obj.Id().String(), nil } -func (createOperationResolver) Date(ctx context.Context, obj *bug.CreateOperation) (*time.Time, error) { +func (createOperationResolver) Author(_ context.Context, obj *bug.CreateOperation) (models.IdentityWrapper, error) { + return models.NewLoadedIdentity(obj.Author), nil +} + +func (createOperationResolver) Date(_ context.Context, obj *bug.CreateOperation) (*time.Time, error) { t := obj.Time() return &t, nil } @@ -27,11 +31,15 @@ var _ graph.AddCommentOperationResolver = addCommentOperationResolver{} type addCommentOperationResolver struct{} -func (addCommentOperationResolver) ID(ctx context.Context, obj *bug.AddCommentOperation) (string, error) { +func (addCommentOperationResolver) ID(_ context.Context, obj *bug.AddCommentOperation) (string, error) { return obj.Id().String(), nil } -func (addCommentOperationResolver) Date(ctx context.Context, obj *bug.AddCommentOperation) (*time.Time, error) { +func (addCommentOperationResolver) Author(_ context.Context, obj *bug.AddCommentOperation) (models.IdentityWrapper, error) { + return models.NewLoadedIdentity(obj.Author), nil +} + +func (addCommentOperationResolver) Date(_ context.Context, obj *bug.AddCommentOperation) (*time.Time, error) { t := obj.Time() return &t, nil } @@ -40,15 +48,19 @@ var _ graph.EditCommentOperationResolver = editCommentOperationResolver{} type editCommentOperationResolver struct{} -func (editCommentOperationResolver) ID(ctx context.Context, obj *bug.EditCommentOperation) (string, error) { +func (editCommentOperationResolver) ID(_ context.Context, obj *bug.EditCommentOperation) (string, error) { return obj.Id().String(), nil } -func (editCommentOperationResolver) Target(ctx context.Context, obj *bug.EditCommentOperation) (string, error) { +func (editCommentOperationResolver) Target(_ context.Context, obj *bug.EditCommentOperation) (string, error) { return obj.Target.String(), nil } -func (editCommentOperationResolver) Date(ctx context.Context, obj *bug.EditCommentOperation) (*time.Time, error) { +func (editCommentOperationResolver) Author(_ context.Context, obj *bug.EditCommentOperation) (models.IdentityWrapper, error) { + return models.NewLoadedIdentity(obj.Author), nil +} + +func (editCommentOperationResolver) Date(_ context.Context, obj *bug.EditCommentOperation) (*time.Time, error) { t := obj.Time() return &t, nil } @@ -57,11 +69,15 @@ var _ graph.LabelChangeOperationResolver = labelChangeOperationResolver{} type labelChangeOperationResolver struct{} -func (labelChangeOperationResolver) ID(ctx context.Context, obj *bug.LabelChangeOperation) (string, error) { +func (labelChangeOperationResolver) ID(_ context.Context, obj *bug.LabelChangeOperation) (string, error) { return obj.Id().String(), nil } -func (labelChangeOperationResolver) Date(ctx context.Context, obj *bug.LabelChangeOperation) (*time.Time, error) { +func (labelChangeOperationResolver) Author(_ context.Context, obj *bug.LabelChangeOperation) (models.IdentityWrapper, error) { + return models.NewLoadedIdentity(obj.Author), nil +} + +func (labelChangeOperationResolver) Date(_ context.Context, obj *bug.LabelChangeOperation) (*time.Time, error) { t := obj.Time() return &t, nil } @@ -70,16 +86,20 @@ var _ graph.SetStatusOperationResolver = setStatusOperationResolver{} type setStatusOperationResolver struct{} -func (setStatusOperationResolver) ID(ctx context.Context, obj *bug.SetStatusOperation) (string, error) { +func (setStatusOperationResolver) ID(_ context.Context, obj *bug.SetStatusOperation) (string, error) { return obj.Id().String(), nil } -func (setStatusOperationResolver) Date(ctx context.Context, obj *bug.SetStatusOperation) (*time.Time, error) { +func (setStatusOperationResolver) Author(_ context.Context, obj *bug.SetStatusOperation) (models.IdentityWrapper, error) { + return models.NewLoadedIdentity(obj.Author), nil +} + +func (setStatusOperationResolver) Date(_ context.Context, obj *bug.SetStatusOperation) (*time.Time, error) { t := obj.Time() return &t, nil } -func (setStatusOperationResolver) Status(ctx context.Context, obj *bug.SetStatusOperation) (models.Status, error) { +func (setStatusOperationResolver) Status(_ context.Context, obj *bug.SetStatusOperation) (models.Status, error) { return convertStatus(obj.Status) } @@ -87,11 +107,15 @@ var _ graph.SetTitleOperationResolver = setTitleOperationResolver{} type setTitleOperationResolver struct{} -func (setTitleOperationResolver) ID(ctx context.Context, obj *bug.SetTitleOperation) (string, error) { +func (setTitleOperationResolver) ID(_ context.Context, obj *bug.SetTitleOperation) (string, error) { return obj.Id().String(), nil } -func (setTitleOperationResolver) Date(ctx context.Context, obj *bug.SetTitleOperation) (*time.Time, error) { +func (setTitleOperationResolver) Author(_ context.Context, obj *bug.SetTitleOperation) (models.IdentityWrapper, error) { + return models.NewLoadedIdentity(obj.Author), nil +} + +func (setTitleOperationResolver) Date(_ context.Context, obj *bug.SetTitleOperation) (*time.Time, error) { t := obj.Time() return &t, nil } |