diff options
author | Michael Muré <batolettre@gmail.com> | 2019-08-12 16:12:14 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2019-08-12 16:12:14 +0200 |
commit | 99b5c58d43137bd9f6503788a55484327b0c531f (patch) | |
tree | 08ecc0f923b5f1fb4e8a7627aeabccb335d92ad1 /graphql/resolvers/operations.go | |
parent | 67a3752e176790e82a48706236f889cab4f8913d (diff) | |
download | git-bug-99b5c58d43137bd9f6503788a55484327b0c531f.tar.gz |
finish the refactoring for the dedicated identifier type
Diffstat (limited to 'graphql/resolvers/operations.go')
-rw-r--r-- | graphql/resolvers/operations.go | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/graphql/resolvers/operations.go b/graphql/resolvers/operations.go index 19b2b17f..3080c98b 100644 --- a/graphql/resolvers/operations.go +++ b/graphql/resolvers/operations.go @@ -6,39 +6,74 @@ import ( "time" "github.com/MichaelMure/git-bug/bug" + "github.com/MichaelMure/git-bug/graphql/graph" "github.com/MichaelMure/git-bug/graphql/models" ) +var _ graph.CreateOperationResolver = createOperationResolver{} + type createOperationResolver struct{} +func (createOperationResolver) ID(ctx context.Context, obj *bug.CreateOperation) (string, error) { + return obj.Id().String(), nil +} + func (createOperationResolver) Date(ctx context.Context, obj *bug.CreateOperation) (*time.Time, error) { t := obj.Time() return &t, nil } +var _ graph.AddCommentOperationResolver = addCommentOperationResolver{} + type addCommentOperationResolver struct{} +func (addCommentOperationResolver) ID(ctx context.Context, obj *bug.AddCommentOperation) (string, error) { + return obj.Id().String(), nil +} + func (addCommentOperationResolver) Date(ctx context.Context, obj *bug.AddCommentOperation) (*time.Time, error) { t := obj.Time() return &t, nil } +var _ graph.EditCommentOperationResolver = editCommentOperationResolver{} + type editCommentOperationResolver struct{} +func (editCommentOperationResolver) ID(ctx context.Context, obj *bug.EditCommentOperation) (string, error) { + return obj.Id().String(), nil +} + +func (editCommentOperationResolver) Target(ctx context.Context, obj *bug.EditCommentOperation) (string, error) { + panic("implement me") +} + func (editCommentOperationResolver) Date(ctx context.Context, obj *bug.EditCommentOperation) (*time.Time, error) { t := obj.Time() return &t, nil } -type labelChangeOperation struct{} +var _ graph.LabelChangeOperationResolver = labelChangeOperationResolver{} + +type labelChangeOperationResolver struct{} -func (labelChangeOperation) Date(ctx context.Context, obj *bug.LabelChangeOperation) (*time.Time, error) { +func (labelChangeOperationResolver) ID(ctx context.Context, obj *bug.LabelChangeOperation) (string, error) { + return obj.Id().String(), nil +} + +func (labelChangeOperationResolver) Date(ctx context.Context, obj *bug.LabelChangeOperation) (*time.Time, error) { t := obj.Time() return &t, nil } +var _ graph.SetStatusOperationResolver = setStatusOperationResolver{} + type setStatusOperationResolver struct{} +func (setStatusOperationResolver) ID(ctx context.Context, obj *bug.SetStatusOperation) (string, error) { + return obj.Id().String(), nil +} + func (setStatusOperationResolver) Date(ctx context.Context, obj *bug.SetStatusOperation) (*time.Time, error) { t := obj.Time() return &t, nil @@ -48,8 +83,14 @@ func (setStatusOperationResolver) Status(ctx context.Context, obj *bug.SetStatus return convertStatus(obj.Status) } +var _ graph.SetTitleOperationResolver = setTitleOperationResolver{} + type setTitleOperationResolver struct{} +func (setTitleOperationResolver) ID(ctx context.Context, obj *bug.SetTitleOperation) (string, error) { + return obj.Id().String(), nil +} + func (setTitleOperationResolver) Date(ctx context.Context, obj *bug.SetTitleOperation) (*time.Time, error) { t := obj.Time() return &t, nil |