From 2a5fbc4dc988d2eea76fe5e844ccf6425f9386ee Mon Sep 17 00:00:00 2001 From: Amine Hilaly Date: Sun, 31 Mar 2019 22:32:35 +0200 Subject: Expose actors and participants in snapshot and bug excerpt Append operations authors to each list on Apply() call Expose actors and participants in graphql Add actor/participant query filter and documentation --- graphql/resolvers/bug.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'graphql/resolvers/bug.go') diff --git a/graphql/resolvers/bug.go b/graphql/resolvers/bug.go index 7af04934..f48ff0a7 100644 --- a/graphql/resolvers/bug.go +++ b/graphql/resolvers/bug.go @@ -8,6 +8,7 @@ import ( "github.com/MichaelMure/git-bug/graphql/connections" "github.com/MichaelMure/git-bug/graphql/graph" "github.com/MichaelMure/git-bug/graphql/models" + "github.com/MichaelMure/git-bug/identity" ) var _ graph.BugResolver = &bugResolver{} @@ -102,3 +103,23 @@ func (bugResolver) Timeline(ctx context.Context, obj *bug.Snapshot, after *strin func (bugResolver) LastEdit(ctx context.Context, obj *bug.Snapshot) (time.Time, error) { return obj.LastEditTime(), nil } + +func (bugResolver) Actors(ctx context.Context, obj *bug.Snapshot) ([]*identity.Interface, error) { + actorsp := make([]*identity.Interface, len(obj.Actors)) + + for i, actor := range obj.Actors { + actorsp[i] = &actor + } + + return actorsp, nil +} + +func (bugResolver) Participants(ctx context.Context, obj *bug.Snapshot) ([]*identity.Interface, error) { + participantsp := make([]*identity.Interface, len(obj.Participants)) + + for i, participant := range obj.Participants { + participantsp[i] = &participant + } + + return participantsp, nil +} -- cgit