aboutsummaryrefslogtreecommitdiffstats
path: root/graphql/resolvers
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-09-30 17:15:54 +0200
committerMichael Muré <batolettre@gmail.com>2018-09-30 17:15:54 +0200
commit7f86898ef9a8f9e866835ece3c9824a8edc58036 (patch)
tree5c5733c9272f3477317935bde6ecb4680276b717 /graphql/resolvers
parentd71bb7dd7632780cf5aad5fda84027fa03a9d0f0 (diff)
downloadgit-bug-7f86898ef9a8f9e866835ece3c9824a8edc58036.tar.gz
bug: use deditated type for all TimelineItem
Diffstat (limited to 'graphql/resolvers')
-rw-r--r--graphql/resolvers/root.go16
-rw-r--r--graphql/resolvers/timeline.go29
2 files changed, 39 insertions, 6 deletions
diff --git a/graphql/resolvers/root.go b/graphql/resolvers/root.go
index 2322edc7..b1ce0356 100644
--- a/graphql/resolvers/root.go
+++ b/graphql/resolvers/root.go
@@ -40,14 +40,26 @@ func (RootResolver) CommentHistoryStep() graph.CommentHistoryStepResolver {
return &commentHistoryStepResolver{}
}
-func (RootResolver) CommentTimelineItem() graph.CommentTimelineItemResolver {
- return &commentTimelineItemResolver{}
+func (RootResolver) AddCommentTimelineItem() graph.AddCommentTimelineItemResolver {
+ return &addCommentTimelineItemResolver{}
}
func (RootResolver) CreateTimelineItem() graph.CreateTimelineItemResolver {
return &createTimelineItemResolver{}
}
+func (r RootResolver) LabelChangeTimelineItem() graph.LabelChangeTimelineItemResolver {
+ return &labelChangeTimelineItem{}
+}
+
+func (r RootResolver) SetStatusTimelineItem() graph.SetStatusTimelineItemResolver {
+ return &setStatusTimelineItem{}
+}
+
+func (r RootResolver) SetTitleTimelineItem() graph.SetTitleTimelineItemResolver {
+ return &setTitleTimelineItem{}
+}
+
func (RootResolver) CreateOperation() graph.CreateOperationResolver {
return &createOperationResolver{}
}
diff --git a/graphql/resolvers/timeline.go b/graphql/resolvers/timeline.go
index 9b8262fe..42e0a643 100644
--- a/graphql/resolvers/timeline.go
+++ b/graphql/resolvers/timeline.go
@@ -5,6 +5,7 @@ import (
"time"
"github.com/MichaelMure/git-bug/bug"
+ "github.com/MichaelMure/git-bug/graphql/models"
)
type commentHistoryStepResolver struct{}
@@ -13,13 +14,13 @@ func (commentHistoryStepResolver) Date(ctx context.Context, obj *bug.CommentHist
return obj.UnixTime.Time(), nil
}
-type commentTimelineItemResolver struct{}
+type addCommentTimelineItemResolver struct{}
-func (commentTimelineItemResolver) CreatedAt(ctx context.Context, obj *bug.CommentTimelineItem) (time.Time, error) {
+func (addCommentTimelineItemResolver) CreatedAt(ctx context.Context, obj *bug.AddCommentTimelineItem) (time.Time, error) {
return obj.CreatedAt.Time(), nil
}
-func (commentTimelineItemResolver) LastEdit(ctx context.Context, obj *bug.CommentTimelineItem) (time.Time, error) {
+func (addCommentTimelineItemResolver) LastEdit(ctx context.Context, obj *bug.AddCommentTimelineItem) (time.Time, error) {
return obj.LastEdit.Time(), nil
}
@@ -27,10 +28,30 @@ 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
+}
+
+type labelChangeTimelineItem struct{}
+
+func (labelChangeTimelineItem) Date(ctx context.Context, obj *bug.LabelChangeTimelineItem) (time.Time, error) {
+ return obj.UnixTime.Time(), nil
+}
+
+type setStatusTimelineItem struct{}
+func (setStatusTimelineItem) Date(ctx context.Context, obj *bug.SetStatusTimelineItem) (time.Time, error) {
+ return obj.UnixTime.Time(), nil
+}
+
+func (setStatusTimelineItem) Status(ctx context.Context, obj *bug.SetStatusTimelineItem) (models.Status, error) {
+ return convertStatus(obj.Status)
+}
+
+type setTitleTimelineItem struct{}
+
+func (setTitleTimelineItem) Date(ctx context.Context, obj *bug.SetTitleTimelineItem) (time.Time, error) {
+ return obj.UnixTime.Time(), nil
}