aboutsummaryrefslogtreecommitdiffstats
path: root/graphql/resolvers/timeline.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-02-09 02:56:37 +0100
committerGitHub <noreply@github.com>2020-02-09 02:56:37 +0100
commit3caffeef4d2ed25d4eb5d4bfd262f4fc3b92561f (patch)
tree40730a7ff92a420af65d9d2560a07d47a6a72174 /graphql/resolvers/timeline.go
parent9e1a987b4d94dc5c2115423ede5954d4faf1d342 (diff)
parent2af456f5e05f242d9e13049e038b9bd2d6dfc1cc (diff)
downloadgit-bug-3caffeef4d2ed25d4eb5d4bfd262f4fc3b92561f.tar.gz
Merge pull request #316 from MichaelMure/lazy-graphql
graphql: use the cache in priority for fast browsing in the WebUI
Diffstat (limited to 'graphql/resolvers/timeline.go')
-rw-r--r--graphql/resolvers/timeline.go48
1 files changed, 34 insertions, 14 deletions
diff --git a/graphql/resolvers/timeline.go b/graphql/resolvers/timeline.go
index b206f898..acf236f8 100644
--- a/graphql/resolvers/timeline.go
+++ b/graphql/resolvers/timeline.go
@@ -13,7 +13,7 @@ var _ graph.CommentHistoryStepResolver = commentHistoryStepResolver{}
type commentHistoryStepResolver struct{}
-func (commentHistoryStepResolver) Date(ctx context.Context, obj *bug.CommentHistoryStep) (*time.Time, error) {
+func (commentHistoryStepResolver) Date(_ context.Context, obj *bug.CommentHistoryStep) (*time.Time, error) {
t := obj.UnixTime.Time()
return &t, nil
}
@@ -22,16 +22,20 @@ var _ graph.AddCommentTimelineItemResolver = addCommentTimelineItemResolver{}
type addCommentTimelineItemResolver struct{}
-func (addCommentTimelineItemResolver) ID(ctx context.Context, obj *bug.AddCommentTimelineItem) (string, error) {
+func (addCommentTimelineItemResolver) ID(_ context.Context, obj *bug.AddCommentTimelineItem) (string, error) {
return obj.Id().String(), nil
}
-func (addCommentTimelineItemResolver) CreatedAt(ctx context.Context, obj *bug.AddCommentTimelineItem) (*time.Time, error) {
+func (addCommentTimelineItemResolver) Author(_ context.Context, obj *bug.AddCommentTimelineItem) (models.IdentityWrapper, error) {
+ return models.NewLoadedIdentity(obj.Author), nil
+}
+
+func (addCommentTimelineItemResolver) CreatedAt(_ context.Context, obj *bug.AddCommentTimelineItem) (*time.Time, error) {
t := obj.CreatedAt.Time()
return &t, nil
}
-func (addCommentTimelineItemResolver) LastEdit(ctx context.Context, obj *bug.AddCommentTimelineItem) (*time.Time, error) {
+func (addCommentTimelineItemResolver) LastEdit(_ context.Context, obj *bug.AddCommentTimelineItem) (*time.Time, error) {
t := obj.LastEdit.Time()
return &t, nil
}
@@ -40,16 +44,20 @@ var _ graph.CreateTimelineItemResolver = createTimelineItemResolver{}
type createTimelineItemResolver struct{}
-func (createTimelineItemResolver) ID(ctx context.Context, obj *bug.CreateTimelineItem) (string, error) {
+func (createTimelineItemResolver) ID(_ context.Context, obj *bug.CreateTimelineItem) (string, error) {
return obj.Id().String(), nil
}
-func (createTimelineItemResolver) CreatedAt(ctx context.Context, obj *bug.CreateTimelineItem) (*time.Time, error) {
+func (r createTimelineItemResolver) Author(_ context.Context, obj *bug.CreateTimelineItem) (models.IdentityWrapper, error) {
+ return models.NewLoadedIdentity(obj.Author), nil
+}
+
+func (createTimelineItemResolver) CreatedAt(_ context.Context, obj *bug.CreateTimelineItem) (*time.Time, error) {
t := obj.CreatedAt.Time()
return &t, nil
}
-func (createTimelineItemResolver) LastEdit(ctx context.Context, obj *bug.CreateTimelineItem) (*time.Time, error) {
+func (createTimelineItemResolver) LastEdit(_ context.Context, obj *bug.CreateTimelineItem) (*time.Time, error) {
t := obj.LastEdit.Time()
return &t, nil
}
@@ -58,11 +66,15 @@ var _ graph.LabelChangeTimelineItemResolver = labelChangeTimelineItem{}
type labelChangeTimelineItem struct{}
-func (labelChangeTimelineItem) ID(ctx context.Context, obj *bug.LabelChangeTimelineItem) (string, error) {
+func (labelChangeTimelineItem) ID(_ context.Context, obj *bug.LabelChangeTimelineItem) (string, error) {
return obj.Id().String(), nil
}
-func (labelChangeTimelineItem) Date(ctx context.Context, obj *bug.LabelChangeTimelineItem) (*time.Time, error) {
+func (i labelChangeTimelineItem) Author(_ context.Context, obj *bug.LabelChangeTimelineItem) (models.IdentityWrapper, error) {
+ return models.NewLoadedIdentity(obj.Author), nil
+}
+
+func (labelChangeTimelineItem) Date(_ context.Context, obj *bug.LabelChangeTimelineItem) (*time.Time, error) {
t := obj.UnixTime.Time()
return &t, nil
}
@@ -71,16 +83,20 @@ var _ graph.SetStatusTimelineItemResolver = setStatusTimelineItem{}
type setStatusTimelineItem struct{}
-func (setStatusTimelineItem) ID(ctx context.Context, obj *bug.SetStatusTimelineItem) (string, error) {
+func (setStatusTimelineItem) ID(_ context.Context, obj *bug.SetStatusTimelineItem) (string, error) {
return obj.Id().String(), nil
}
-func (setStatusTimelineItem) Date(ctx context.Context, obj *bug.SetStatusTimelineItem) (*time.Time, error) {
+func (i setStatusTimelineItem) Author(_ context.Context, obj *bug.SetStatusTimelineItem) (models.IdentityWrapper, error) {
+ return models.NewLoadedIdentity(obj.Author), nil
+}
+
+func (setStatusTimelineItem) Date(_ context.Context, obj *bug.SetStatusTimelineItem) (*time.Time, error) {
t := obj.UnixTime.Time()
return &t, nil
}
-func (setStatusTimelineItem) Status(ctx context.Context, obj *bug.SetStatusTimelineItem) (models.Status, error) {
+func (setStatusTimelineItem) Status(_ context.Context, obj *bug.SetStatusTimelineItem) (models.Status, error) {
return convertStatus(obj.Status)
}
@@ -88,11 +104,15 @@ var _ graph.SetTitleTimelineItemResolver = setTitleTimelineItem{}
type setTitleTimelineItem struct{}
-func (setTitleTimelineItem) ID(ctx context.Context, obj *bug.SetTitleTimelineItem) (string, error) {
+func (setTitleTimelineItem) ID(_ context.Context, obj *bug.SetTitleTimelineItem) (string, error) {
return obj.Id().String(), nil
}
-func (setTitleTimelineItem) Date(ctx context.Context, obj *bug.SetTitleTimelineItem) (*time.Time, error) {
+func (i setTitleTimelineItem) Author(_ context.Context, obj *bug.SetTitleTimelineItem) (models.IdentityWrapper, error) {
+ return models.NewLoadedIdentity(obj.Author), nil
+}
+
+func (setTitleTimelineItem) Date(_ context.Context, obj *bug.SetTitleTimelineItem) (*time.Time, error) {
t := obj.UnixTime.Time()
return &t, nil
}