aboutsummaryrefslogtreecommitdiffstats
path: root/graphql/resolvers/timeline.go
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/timeline.go
parentd71bb7dd7632780cf5aad5fda84027fa03a9d0f0 (diff)
downloadgit-bug-7f86898ef9a8f9e866835ece3c9824a8edc58036.tar.gz
bug: use deditated type for all TimelineItem
Diffstat (limited to 'graphql/resolvers/timeline.go')
-rw-r--r--graphql/resolvers/timeline.go29
1 files changed, 25 insertions, 4 deletions
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
}