diff options
Diffstat (limited to 'graphql/resolvers')
-rw-r--r-- | graphql/resolvers/root.go | 16 | ||||
-rw-r--r-- | graphql/resolvers/timeline.go | 36 |
2 files changed, 50 insertions, 2 deletions
diff --git a/graphql/resolvers/root.go b/graphql/resolvers/root.go index ff181784..2322edc7 100644 --- a/graphql/resolvers/root.go +++ b/graphql/resolvers/root.go @@ -32,10 +32,22 @@ func (RootResolver) AddCommentOperation() graph.AddCommentOperationResolver { return &addCommentOperationResolver{} } -func (r RootResolver) Bug() graph.BugResolver { +func (RootResolver) Bug() graph.BugResolver { return &bugResolver{} } +func (RootResolver) CommentHistoryStep() graph.CommentHistoryStepResolver { + return &commentHistoryStepResolver{} +} + +func (RootResolver) CommentTimelineItem() graph.CommentTimelineItemResolver { + return &commentTimelineItemResolver{} +} + +func (RootResolver) CreateTimelineItem() graph.CreateTimelineItemResolver { + return &createTimelineItemResolver{} +} + func (RootResolver) CreateOperation() graph.CreateOperationResolver { return &createOperationResolver{} } @@ -44,7 +56,7 @@ func (RootResolver) LabelChangeOperation() graph.LabelChangeOperationResolver { return &labelChangeOperation{} } -func (r RootResolver) Repository() graph.RepositoryResolver { +func (RootResolver) Repository() graph.RepositoryResolver { return &repoResolver{} } diff --git a/graphql/resolvers/timeline.go b/graphql/resolvers/timeline.go new file mode 100644 index 00000000..9b8262fe --- /dev/null +++ b/graphql/resolvers/timeline.go @@ -0,0 +1,36 @@ +package resolvers + +import ( + "context" + "time" + + "github.com/MichaelMure/git-bug/bug" +) + +type commentHistoryStepResolver struct{} + +func (commentHistoryStepResolver) Date(ctx context.Context, obj *bug.CommentHistoryStep) (time.Time, error) { + return obj.UnixTime.Time(), nil +} + +type commentTimelineItemResolver struct{} + +func (commentTimelineItemResolver) CreatedAt(ctx context.Context, obj *bug.CommentTimelineItem) (time.Time, error) { + return obj.CreatedAt.Time(), nil +} + +func (commentTimelineItemResolver) LastEdit(ctx context.Context, obj *bug.CommentTimelineItem) (time.Time, error) { + return obj.LastEdit.Time(), nil +} + +type createTimelineItemResolver struct{} + +func (createTimelineItemResolver) CreatedAt(ctx context.Context, obj *bug.CreateTimelineItem) (time.Time, error) { + return obj.CreatedAt.Time(), nil + +} + +func (createTimelineItemResolver) LastEdit(ctx context.Context, obj *bug.CreateTimelineItem) (time.Time, error) { + return obj.LastEdit.Time(), nil + +} |