aboutsummaryrefslogtreecommitdiffstats
path: root/api/graphql/resolvers
diff options
context:
space:
mode:
Diffstat (limited to 'api/graphql/resolvers')
-rw-r--r--api/graphql/resolvers/bug.go24
-rw-r--r--api/graphql/resolvers/bug_operations.go61
-rw-r--r--api/graphql/resolvers/bug_root.go59
-rw-r--r--api/graphql/resolvers/bug_timeline.go94
-rw-r--r--api/graphql/resolvers/comment.go22
-rw-r--r--api/graphql/resolvers/identity.go4
-rw-r--r--api/graphql/resolvers/mutation.go36
-rw-r--r--api/graphql/resolvers/operations.go92
-rw-r--r--api/graphql/resolvers/root.go65
-rw-r--r--api/graphql/resolvers/timeline.go115
10 files changed, 255 insertions, 317 deletions
diff --git a/api/graphql/resolvers/bug.go b/api/graphql/resolvers/bug.go
index c984e191..187eee56 100644
--- a/api/graphql/resolvers/bug.go
+++ b/api/graphql/resolvers/bug.go
@@ -18,7 +18,7 @@ func (bugResolver) HumanID(_ context.Context, obj models.BugWrapper) (string, er
return obj.Id().Human(), nil
}
-func (bugResolver) Comments(_ context.Context, obj models.BugWrapper, after *string, before *string, first *int, last *int) (*models.CommentConnection, error) {
+func (bugResolver) Comments(_ context.Context, obj models.BugWrapper, after *string, before *string, first *int, last *int) (*models.BugCommentConnection, error) {
input := models.ConnectionInput{
Before: before,
After: after,
@@ -27,18 +27,18 @@ func (bugResolver) Comments(_ context.Context, obj models.BugWrapper, after *str
}
edger := func(comment bug.Comment, offset int) connections.Edge {
- return models.CommentEdge{
+ return models.BugCommentEdge{
Node: &comment,
Cursor: connections.OffsetToCursor(offset),
}
}
- conMaker := func(edges []*models.CommentEdge, nodes []bug.Comment, info *models.PageInfo, totalCount int) (*models.CommentConnection, error) {
+ conMaker := func(edges []*models.BugCommentEdge, nodes []bug.Comment, info *models.PageInfo, totalCount int) (*models.BugCommentConnection, error) {
var commentNodes []*bug.Comment
for _, c := range nodes {
commentNodes = append(commentNodes, &c)
}
- return &models.CommentConnection{
+ return &models.BugCommentConnection{
Edges: edges,
Nodes: commentNodes,
PageInfo: info,
@@ -86,7 +86,7 @@ func (bugResolver) Operations(_ context.Context, obj models.BugWrapper, after *s
return connections.Connection(ops, edger, conMaker, input)
}
-func (bugResolver) Timeline(_ context.Context, obj models.BugWrapper, after *string, before *string, first *int, last *int) (*models.TimelineItemConnection, error) {
+func (bugResolver) Timeline(_ context.Context, obj models.BugWrapper, after *string, before *string, first *int, last *int) (*models.BugTimelineItemConnection, error) {
input := models.ConnectionInput{
Before: before,
After: after,
@@ -95,14 +95,14 @@ func (bugResolver) Timeline(_ context.Context, obj models.BugWrapper, after *str
}
edger := func(op bug.TimelineItem, offset int) connections.Edge {
- return models.TimelineItemEdge{
+ return models.BugTimelineItemEdge{
Node: op,
Cursor: connections.OffsetToCursor(offset),
}
}
- conMaker := func(edges []*models.TimelineItemEdge, nodes []bug.TimelineItem, info *models.PageInfo, totalCount int) (*models.TimelineItemConnection, error) {
- return &models.TimelineItemConnection{
+ conMaker := func(edges []*models.BugTimelineItemEdge, nodes []bug.TimelineItem, info *models.PageInfo, totalCount int) (*models.BugTimelineItemConnection, error) {
+ return &models.BugTimelineItemConnection{
Edges: edges,
Nodes: nodes,
PageInfo: info,
@@ -181,3 +181,11 @@ func (bugResolver) Participants(_ context.Context, obj models.BugWrapper, after
return connections.Connection(participants, edger, conMaker, input)
}
+
+var _ graph.BugCommentResolver = &commentResolver{}
+
+type commentResolver struct{}
+
+func (c commentResolver) Author(_ context.Context, obj *bug.Comment) (models.IdentityWrapper, error) {
+ return models.NewLoadedIdentity(obj.Author), nil
+}
diff --git a/api/graphql/resolvers/bug_operations.go b/api/graphql/resolvers/bug_operations.go
new file mode 100644
index 00000000..cf9d9056
--- /dev/null
+++ b/api/graphql/resolvers/bug_operations.go
@@ -0,0 +1,61 @@
+package resolvers
+
+import (
+ "context"
+
+ "github.com/git-bug/git-bug/api/graphql/graph"
+ "github.com/git-bug/git-bug/api/graphql/models"
+ "github.com/git-bug/git-bug/entities/bug"
+)
+
+var _ graph.BugCreateOperationResolver = bugCreateOperationResolver{}
+
+type bugCreateOperationResolver struct{}
+
+func (bugCreateOperationResolver) Author(_ context.Context, obj *bug.CreateOperation) (models.IdentityWrapper, error) {
+ return models.NewLoadedIdentity(obj.Author()), nil
+}
+
+var _ graph.BugAddCommentOperationResolver = bugAddCommentOperationResolver{}
+
+type bugAddCommentOperationResolver struct{}
+
+func (bugAddCommentOperationResolver) Author(_ context.Context, obj *bug.AddCommentOperation) (models.IdentityWrapper, error) {
+ return models.NewLoadedIdentity(obj.Author()), nil
+}
+
+var _ graph.BugEditCommentOperationResolver = bugEditCommentOperationResolver{}
+
+type bugEditCommentOperationResolver struct{}
+
+func (bugEditCommentOperationResolver) Target(_ context.Context, obj *bug.EditCommentOperation) (string, error) {
+ return obj.Target.String(), nil
+}
+
+func (bugEditCommentOperationResolver) Author(_ context.Context, obj *bug.EditCommentOperation) (models.IdentityWrapper, error) {
+ return models.NewLoadedIdentity(obj.Author()), nil
+}
+
+var _ graph.BugLabelChangeOperationResolver = bugLabelChangeOperationResolver{}
+
+type bugLabelChangeOperationResolver struct{}
+
+func (bugLabelChangeOperationResolver) Author(_ context.Context, obj *bug.LabelChangeOperation) (models.IdentityWrapper, error) {
+ return models.NewLoadedIdentity(obj.Author()), nil
+}
+
+var _ graph.BugSetStatusOperationResolver = bugSetStatusOperationResolver{}
+
+type bugSetStatusOperationResolver struct{}
+
+func (bugSetStatusOperationResolver) Author(_ context.Context, obj *bug.SetStatusOperation) (models.IdentityWrapper, error) {
+ return models.NewLoadedIdentity(obj.Author()), nil
+}
+
+var _ graph.BugSetTitleOperationResolver = bugSetTitleOperationResolver{}
+
+type bugSetTitleOperationResolver struct{}
+
+func (bugSetTitleOperationResolver) Author(_ context.Context, obj *bug.SetTitleOperation) (models.IdentityWrapper, error) {
+ return models.NewLoadedIdentity(obj.Author()), nil
+}
diff --git a/api/graphql/resolvers/bug_root.go b/api/graphql/resolvers/bug_root.go
new file mode 100644
index 00000000..2013a066
--- /dev/null
+++ b/api/graphql/resolvers/bug_root.go
@@ -0,0 +1,59 @@
+package resolvers
+
+import (
+ "github.com/git-bug/git-bug/api/graphql/graph"
+)
+
+type bugRootSubResolver struct{}
+
+func (bugRootSubResolver) BugAddCommentOperation() graph.BugAddCommentOperationResolver {
+ return &bugAddCommentOperationResolver{}
+}
+
+func (bugRootSubResolver) BugAddCommentTimelineItem() graph.BugAddCommentTimelineItemResolver {
+ return &bugAddCommentTimelineItemResolver{}
+}
+
+func (r bugRootSubResolver) BugComment() graph.BugCommentResolver {
+ return &commentResolver{}
+}
+
+func (bugRootSubResolver) BugCommentHistoryStep() graph.BugCommentHistoryStepResolver {
+ return &bugCommentHistoryStepResolver{}
+}
+
+func (bugRootSubResolver) BugCreateOperation() graph.BugCreateOperationResolver {
+ return &bugCreateOperationResolver{}
+}
+
+func (bugRootSubResolver) BugCreateTimelineItem() graph.BugCreateTimelineItemResolver {
+ return &bugCreateTimelineItemResolver{}
+}
+
+func (r bugRootSubResolver) BugEditCommentOperation() graph.BugEditCommentOperationResolver {
+ return &bugEditCommentOperationResolver{}
+}
+
+func (bugRootSubResolver) BugLabelChangeOperation() graph.BugLabelChangeOperationResolver {
+ return &bugLabelChangeOperationResolver{}
+}
+
+func (r bugRootSubResolver) BugLabelChangeTimelineItem() graph.BugLabelChangeTimelineItemResolver {
+ return &bugLabelChangeTimelineItem{}
+}
+
+func (bugRootSubResolver) BugSetStatusOperation() graph.BugSetStatusOperationResolver {
+ return &bugSetStatusOperationResolver{}
+}
+
+func (r bugRootSubResolver) BugSetStatusTimelineItem() graph.BugSetStatusTimelineItemResolver {
+ return &bugSetStatusTimelineItem{}
+}
+
+func (r bugRootSubResolver) BugSetTitleOperation() graph.BugSetTitleOperationResolver {
+ return &bugSetTitleOperationResolver{}
+}
+
+func (r bugRootSubResolver) BugSetTitleTimelineItem() graph.BugSetTitleTimelineItemResolver {
+ return &bugSetTitleTimelineItem{}
+}
diff --git a/api/graphql/resolvers/bug_timeline.go b/api/graphql/resolvers/bug_timeline.go
new file mode 100644
index 00000000..e570053c
--- /dev/null
+++ b/api/graphql/resolvers/bug_timeline.go
@@ -0,0 +1,94 @@
+package resolvers
+
+import (
+ "context"
+ "time"
+
+ "github.com/git-bug/git-bug/api/graphql/graph"
+ "github.com/git-bug/git-bug/api/graphql/models"
+ "github.com/git-bug/git-bug/entities/bug"
+)
+
+var _ graph.BugCommentHistoryStepResolver = bugCommentHistoryStepResolver{}
+
+type bugCommentHistoryStepResolver struct{}
+
+func (bugCommentHistoryStepResolver) Date(_ context.Context, obj *bug.CommentHistoryStep) (*time.Time, error) {
+ t := obj.UnixTime.Time()
+ return &t, nil
+}
+
+var _ graph.BugAddCommentTimelineItemResolver = bugAddCommentTimelineItemResolver{}
+
+type bugAddCommentTimelineItemResolver struct{}
+
+func (bugAddCommentTimelineItemResolver) Author(_ context.Context, obj *bug.AddCommentTimelineItem) (models.IdentityWrapper, error) {
+ return models.NewLoadedIdentity(obj.Author), nil
+}
+
+func (bugAddCommentTimelineItemResolver) CreatedAt(_ context.Context, obj *bug.AddCommentTimelineItem) (*time.Time, error) {
+ t := obj.CreatedAt.Time()
+ return &t, nil
+}
+
+func (bugAddCommentTimelineItemResolver) LastEdit(_ context.Context, obj *bug.AddCommentTimelineItem) (*time.Time, error) {
+ t := obj.LastEdit.Time()
+ return &t, nil
+}
+
+var _ graph.BugCreateTimelineItemResolver = bugCreateTimelineItemResolver{}
+
+type bugCreateTimelineItemResolver struct{}
+
+func (r bugCreateTimelineItemResolver) Author(_ context.Context, obj *bug.CreateTimelineItem) (models.IdentityWrapper, error) {
+ return models.NewLoadedIdentity(obj.Author), nil
+}
+
+func (bugCreateTimelineItemResolver) CreatedAt(_ context.Context, obj *bug.CreateTimelineItem) (*time.Time, error) {
+ t := obj.CreatedAt.Time()
+ return &t, nil
+}
+
+func (bugCreateTimelineItemResolver) LastEdit(_ context.Context, obj *bug.CreateTimelineItem) (*time.Time, error) {
+ t := obj.LastEdit.Time()
+ return &t, nil
+}
+
+var _ graph.BugLabelChangeTimelineItemResolver = bugLabelChangeTimelineItem{}
+
+type bugLabelChangeTimelineItem struct{}
+
+func (i bugLabelChangeTimelineItem) Author(_ context.Context, obj *bug.LabelChangeTimelineItem) (models.IdentityWrapper, error) {
+ return models.NewLoadedIdentity(obj.Author), nil
+}
+
+func (bugLabelChangeTimelineItem) Date(_ context.Context, obj *bug.LabelChangeTimelineItem) (*time.Time, error) {
+ t := obj.UnixTime.Time()
+ return &t, nil
+}
+
+var _ graph.BugSetStatusTimelineItemResolver = bugSetStatusTimelineItem{}
+
+type bugSetStatusTimelineItem struct{}
+
+func (i bugSetStatusTimelineItem) Author(_ context.Context, obj *bug.SetStatusTimelineItem) (models.IdentityWrapper, error) {
+ return models.NewLoadedIdentity(obj.Author), nil
+}
+
+func (bugSetStatusTimelineItem) Date(_ context.Context, obj *bug.SetStatusTimelineItem) (*time.Time, error) {
+ t := obj.UnixTime.Time()
+ return &t, nil
+}
+
+var _ graph.BugSetTitleTimelineItemResolver = bugSetTitleTimelineItem{}
+
+type bugSetTitleTimelineItem struct{}
+
+func (i bugSetTitleTimelineItem) Author(_ context.Context, obj *bug.SetTitleTimelineItem) (models.IdentityWrapper, error) {
+ return models.NewLoadedIdentity(obj.Author), nil
+}
+
+func (bugSetTitleTimelineItem) Date(_ context.Context, obj *bug.SetTitleTimelineItem) (*time.Time, error) {
+ t := obj.UnixTime.Time()
+ return &t, nil
+}
diff --git a/api/graphql/resolvers/comment.go b/api/graphql/resolvers/comment.go
deleted file mode 100644
index 01c17416..00000000
--- a/api/graphql/resolvers/comment.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package resolvers
-
-import (
- "context"
-
- "github.com/git-bug/git-bug/api/graphql/graph"
- "github.com/git-bug/git-bug/api/graphql/models"
- "github.com/git-bug/git-bug/entities/bug"
- "github.com/git-bug/git-bug/entity"
-)
-
-var _ graph.CommentResolver = &commentResolver{}
-
-type commentResolver struct{}
-
-func (c commentResolver) ID(ctx context.Context, obj *bug.Comment) (entity.CombinedId, error) {
- return obj.CombinedId(), nil
-}
-
-func (c commentResolver) Author(_ context.Context, obj *bug.Comment) (models.IdentityWrapper, error) {
- return models.NewLoadedIdentity(obj.Author), nil
-}
diff --git a/api/graphql/resolvers/identity.go b/api/graphql/resolvers/identity.go
index 6e81df36..b9a1828f 100644
--- a/api/graphql/resolvers/identity.go
+++ b/api/graphql/resolvers/identity.go
@@ -11,10 +11,6 @@ var _ graph.IdentityResolver = &identityResolver{}
type identityResolver struct{}
-func (identityResolver) ID(ctx context.Context, obj models.IdentityWrapper) (string, error) {
- return obj.Id().String(), nil
-}
-
func (r identityResolver) HumanID(ctx context.Context, obj models.IdentityWrapper) (string, error) {
return obj.Id().Human(), nil
diff --git a/api/graphql/resolvers/mutation.go b/api/graphql/resolvers/mutation.go
index ab00fb4c..7bd09527 100644
--- a/api/graphql/resolvers/mutation.go
+++ b/api/graphql/resolvers/mutation.go
@@ -39,7 +39,7 @@ func (r mutationResolver) getBug(repoRef *string, bugPrefix string) (*cache.Repo
return repo, b, nil
}
-func (r mutationResolver) NewBug(ctx context.Context, input models.NewBugInput) (*models.NewBugPayload, error) {
+func (r mutationResolver) BugCreate(ctx context.Context, input models.BugCreateInput) (*models.BugCreatePayload, error) {
repo, err := r.getRepo(input.RepoRef)
if err != nil {
return nil, err
@@ -60,14 +60,14 @@ func (r mutationResolver) NewBug(ctx context.Context, input models.NewBugInput)
return nil, err
}
- return &models.NewBugPayload{
+ return &models.BugCreatePayload{
ClientMutationID: input.ClientMutationID,
Bug: models.NewLoadedBug(b.Snapshot()),
Operation: op,
}, nil
}
-func (r mutationResolver) AddComment(ctx context.Context, input models.AddCommentInput) (*models.AddCommentPayload, error) {
+func (r mutationResolver) BugAddComment(ctx context.Context, input models.BugAddCommentInput) (*models.BugAddCommentPayload, error) {
repo, b, err := r.getBug(input.RepoRef, input.Prefix)
if err != nil {
return nil, err
@@ -92,14 +92,14 @@ func (r mutationResolver) AddComment(ctx context.Context, input models.AddCommen
return nil, err
}
- return &models.AddCommentPayload{
+ return &models.BugAddCommentPayload{
ClientMutationID: input.ClientMutationID,
Bug: models.NewLoadedBug(b.Snapshot()),
Operation: op,
}, nil
}
-func (r mutationResolver) AddCommentAndClose(ctx context.Context, input models.AddCommentAndCloseBugInput) (*models.AddCommentAndCloseBugPayload, error) {
+func (r mutationResolver) BugAddCommentAndClose(ctx context.Context, input models.BugAddCommentAndCloseInput) (*models.BugAddCommentAndClosePayload, error) {
repo, b, err := r.getBug(input.RepoRef, input.Prefix)
if err != nil {
return nil, err
@@ -129,7 +129,7 @@ func (r mutationResolver) AddCommentAndClose(ctx context.Context, input models.A
return nil, err
}
- return &models.AddCommentAndCloseBugPayload{
+ return &models.BugAddCommentAndClosePayload{
ClientMutationID: input.ClientMutationID,
Bug: models.NewLoadedBug(b.Snapshot()),
CommentOperation: opAddComment,
@@ -137,7 +137,7 @@ func (r mutationResolver) AddCommentAndClose(ctx context.Context, input models.A
}, nil
}
-func (r mutationResolver) AddCommentAndReopen(ctx context.Context, input models.AddCommentAndReopenBugInput) (*models.AddCommentAndReopenBugPayload, error) {
+func (r mutationResolver) BugAddCommentAndReopen(ctx context.Context, input models.BugAddCommentAndReopenInput) (*models.BugAddCommentAndReopenPayload, error) {
repo, b, err := r.getBug(input.RepoRef, input.Prefix)
if err != nil {
return nil, err
@@ -167,7 +167,7 @@ func (r mutationResolver) AddCommentAndReopen(ctx context.Context, input models.
return nil, err
}
- return &models.AddCommentAndReopenBugPayload{
+ return &models.BugAddCommentAndReopenPayload{
ClientMutationID: input.ClientMutationID,
Bug: models.NewLoadedBug(b.Snapshot()),
CommentOperation: opAddComment,
@@ -175,7 +175,7 @@ func (r mutationResolver) AddCommentAndReopen(ctx context.Context, input models.
}, nil
}
-func (r mutationResolver) EditComment(ctx context.Context, input models.EditCommentInput) (*models.EditCommentPayload, error) {
+func (r mutationResolver) BugEditComment(ctx context.Context, input models.BugEditCommentInput) (*models.BugEditCommentPayload, error) {
repo, err := r.getRepo(input.RepoRef)
if err != nil {
return nil, err
@@ -207,14 +207,14 @@ func (r mutationResolver) EditComment(ctx context.Context, input models.EditComm
return nil, err
}
- return &models.EditCommentPayload{
+ return &models.BugEditCommentPayload{
ClientMutationID: input.ClientMutationID,
Bug: models.NewLoadedBug(b.Snapshot()),
Operation: op,
}, nil
}
-func (r mutationResolver) ChangeLabels(ctx context.Context, input *models.ChangeLabelInput) (*models.ChangeLabelPayload, error) {
+func (r mutationResolver) BugChangeLabels(ctx context.Context, input *models.BugChangeLabelInput) (*models.BugChangeLabelPayload, error) {
repo, b, err := r.getBug(input.RepoRef, input.Prefix)
if err != nil {
return nil, err
@@ -246,7 +246,7 @@ func (r mutationResolver) ChangeLabels(ctx context.Context, input *models.Change
resultsPtr[i] = &result
}
- return &models.ChangeLabelPayload{
+ return &models.BugChangeLabelPayload{
ClientMutationID: input.ClientMutationID,
Bug: models.NewLoadedBug(b.Snapshot()),
Operation: op,
@@ -254,7 +254,7 @@ func (r mutationResolver) ChangeLabels(ctx context.Context, input *models.Change
}, nil
}
-func (r mutationResolver) OpenBug(ctx context.Context, input models.OpenBugInput) (*models.OpenBugPayload, error) {
+func (r mutationResolver) BugStatusOpen(ctx context.Context, input models.BugStatusOpenInput) (*models.BugStatusOpenPayload, error) {
repo, b, err := r.getBug(input.RepoRef, input.Prefix)
if err != nil {
return nil, err
@@ -275,14 +275,14 @@ func (r mutationResolver) OpenBug(ctx context.Context, input models.OpenBugInput
return nil, err
}
- return &models.OpenBugPayload{
+ return &models.BugStatusOpenPayload{
ClientMutationID: input.ClientMutationID,
Bug: models.NewLoadedBug(b.Snapshot()),
Operation: op,
}, nil
}
-func (r mutationResolver) CloseBug(ctx context.Context, input models.CloseBugInput) (*models.CloseBugPayload, error) {
+func (r mutationResolver) BugStatusClose(ctx context.Context, input models.BugStatusCloseInput) (*models.BugStatusClosePayload, error) {
repo, b, err := r.getBug(input.RepoRef, input.Prefix)
if err != nil {
return nil, err
@@ -303,14 +303,14 @@ func (r mutationResolver) CloseBug(ctx context.Context, input models.CloseBugInp
return nil, err
}
- return &models.CloseBugPayload{
+ return &models.BugStatusClosePayload{
ClientMutationID: input.ClientMutationID,
Bug: models.NewLoadedBug(b.Snapshot()),
Operation: op,
}, nil
}
-func (r mutationResolver) SetTitle(ctx context.Context, input models.SetTitleInput) (*models.SetTitlePayload, error) {
+func (r mutationResolver) BugSetTitle(ctx context.Context, input models.BugSetTitleInput) (*models.BugSetTitlePayload, error) {
repo, b, err := r.getBug(input.RepoRef, input.Prefix)
if err != nil {
return nil, err
@@ -336,7 +336,7 @@ func (r mutationResolver) SetTitle(ctx context.Context, input models.SetTitleInp
return nil, err
}
- return &models.SetTitlePayload{
+ return &models.BugSetTitlePayload{
ClientMutationID: input.ClientMutationID,
Bug: models.NewLoadedBug(b.Snapshot()),
Operation: op,
diff --git a/api/graphql/resolvers/operations.go b/api/graphql/resolvers/operations.go
deleted file mode 100644
index 4bb486ed..00000000
--- a/api/graphql/resolvers/operations.go
+++ /dev/null
@@ -1,92 +0,0 @@
-package resolvers
-
-import (
- "context"
- "time"
-
- "github.com/git-bug/git-bug/api/graphql/graph"
- "github.com/git-bug/git-bug/api/graphql/models"
- "github.com/git-bug/git-bug/entities/bug"
-)
-
-var _ graph.CreateOperationResolver = createOperationResolver{}
-
-type createOperationResolver struct{}
-
-func (createOperationResolver) Author(_ context.Context, obj *bug.CreateOperation) (models.IdentityWrapper, error) {
- return models.NewLoadedIdentity(obj.Author()), nil
-}
-
-func (createOperationResolver) Date(_ context.Context, obj *bug.CreateOperation) (*time.Time, error) {
- t := obj.Time()
- return &t, nil
-}
-
-var _ graph.AddCommentOperationResolver = addCommentOperationResolver{}
-
-type addCommentOperationResolver struct{}
-
-func (addCommentOperationResolver) Author(_ context.Context, obj *bug.AddCommentOperation) (models.IdentityWrapper, error) {
- return models.NewLoadedIdentity(obj.Author()), nil
-}
-
-func (addCommentOperationResolver) Date(_ context.Context, obj *bug.AddCommentOperation) (*time.Time, error) {
- t := obj.Time()
- return &t, nil
-}
-
-var _ graph.EditCommentOperationResolver = editCommentOperationResolver{}
-
-type editCommentOperationResolver struct{}
-
-func (editCommentOperationResolver) Target(_ context.Context, obj *bug.EditCommentOperation) (string, error) {
- return obj.Target.String(), nil
-}
-
-func (editCommentOperationResolver) Author(_ context.Context, obj *bug.EditCommentOperation) (models.IdentityWrapper, error) {
- return models.NewLoadedIdentity(obj.Author()), nil
-}
-
-func (editCommentOperationResolver) Date(_ context.Context, obj *bug.EditCommentOperation) (*time.Time, error) {
- t := obj.Time()
- return &t, nil
-}
-
-var _ graph.LabelChangeOperationResolver = labelChangeOperationResolver{}
-
-type labelChangeOperationResolver struct{}
-
-func (labelChangeOperationResolver) Author(_ context.Context, obj *bug.LabelChangeOperation) (models.IdentityWrapper, error) {
- return models.NewLoadedIdentity(obj.Author()), nil
-}
-
-func (labelChangeOperationResolver) Date(_ context.Context, obj *bug.LabelChangeOperation) (*time.Time, error) {
- t := obj.Time()
- return &t, nil
-}
-
-var _ graph.SetStatusOperationResolver = setStatusOperationResolver{}
-
-type setStatusOperationResolver struct{}
-
-func (setStatusOperationResolver) Author(_ context.Context, obj *bug.SetStatusOperation) (models.IdentityWrapper, error) {
- return models.NewLoadedIdentity(obj.Author()), nil
-}
-
-func (setStatusOperationResolver) Date(_ context.Context, obj *bug.SetStatusOperation) (*time.Time, error) {
- t := obj.Time()
- return &t, nil
-}
-
-var _ graph.SetTitleOperationResolver = setTitleOperationResolver{}
-
-type setTitleOperationResolver struct{}
-
-func (setTitleOperationResolver) Author(_ context.Context, obj *bug.SetTitleOperation) (models.IdentityWrapper, error) {
- return models.NewLoadedIdentity(obj.Author()), nil
-}
-
-func (setTitleOperationResolver) Date(_ context.Context, obj *bug.SetTitleOperation) (*time.Time, error) {
- t := obj.Time()
- return &t, nil
-}
diff --git a/api/graphql/resolvers/root.go b/api/graphql/resolvers/root.go
index ca0fb8ea..e0fd47eb 100644
--- a/api/graphql/resolvers/root.go
+++ b/api/graphql/resolvers/root.go
@@ -10,6 +10,7 @@ var _ graph.ResolverRoot = &RootResolver{}
type RootResolver struct {
*cache.MultiRepoCache
+ bugRootSubResolver
}
func NewRootResolver(mrc *cache.MultiRepoCache) *RootResolver {
@@ -30,74 +31,22 @@ func (r RootResolver) Mutation() graph.MutationResolver {
}
}
-func (RootResolver) Repository() graph.RepositoryResolver {
- return &repoResolver{}
-}
-
-func (RootResolver) Bug() graph.BugResolver {
- return &bugResolver{}
-}
-
func (RootResolver) Color() graph.ColorResolver {
return &colorResolver{}
}
-func (r RootResolver) Comment() graph.CommentResolver {
- return &commentResolver{}
-}
-
-func (RootResolver) Label() graph.LabelResolver {
- return &labelResolver{}
-}
-
func (r RootResolver) Identity() graph.IdentityResolver {
return &identityResolver{}
}
-func (RootResolver) CommentHistoryStep() graph.CommentHistoryStepResolver {
- return &commentHistoryStepResolver{}
-}
-
-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{}
-}
-
-func (RootResolver) AddCommentOperation() graph.AddCommentOperationResolver {
- return &addCommentOperationResolver{}
-}
-
-func (r RootResolver) EditCommentOperation() graph.EditCommentOperationResolver {
- return &editCommentOperationResolver{}
-}
-
-func (RootResolver) LabelChangeOperation() graph.LabelChangeOperationResolver {
- return &labelChangeOperationResolver{}
+func (RootResolver) Label() graph.LabelResolver {
+ return &labelResolver{}
}
-func (RootResolver) SetStatusOperation() graph.SetStatusOperationResolver {
- return &setStatusOperationResolver{}
+func (RootResolver) Repository() graph.RepositoryResolver {
+ return &repoResolver{}
}
-func (RootResolver) SetTitleOperation() graph.SetTitleOperationResolver {
- return &setTitleOperationResolver{}
+func (RootResolver) Bug() graph.BugResolver {
+ return &bugResolver{}
}
diff --git a/api/graphql/resolvers/timeline.go b/api/graphql/resolvers/timeline.go
deleted file mode 100644
index b710c32c..00000000
--- a/api/graphql/resolvers/timeline.go
+++ /dev/null
@@ -1,115 +0,0 @@
-package resolvers
-
-import (
- "context"
- "time"
-
- "github.com/git-bug/git-bug/api/graphql/graph"
- "github.com/git-bug/git-bug/api/graphql/models"
- "github.com/git-bug/git-bug/entities/bug"
- "github.com/git-bug/git-bug/entity"
-)
-
-var _ graph.CommentHistoryStepResolver = commentHistoryStepResolver{}
-
-type commentHistoryStepResolver struct{}
-
-func (commentHistoryStepResolver) Date(_ context.Context, obj *bug.CommentHistoryStep) (*time.Time, error) {
- t := obj.UnixTime.Time()
- return &t, nil
-}
-
-var _ graph.AddCommentTimelineItemResolver = addCommentTimelineItemResolver{}
-
-type addCommentTimelineItemResolver struct{}
-
-func (addCommentTimelineItemResolver) ID(_ context.Context, obj *bug.AddCommentTimelineItem) (entity.CombinedId, error) {
- return obj.CombinedId(), nil
-}
-
-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(_ context.Context, obj *bug.AddCommentTimelineItem) (*time.Time, error) {
- t := obj.LastEdit.Time()
- return &t, nil
-}
-
-var _ graph.CreateTimelineItemResolver = createTimelineItemResolver{}
-
-type createTimelineItemResolver struct{}
-
-func (createTimelineItemResolver) ID(_ context.Context, obj *bug.CreateTimelineItem) (entity.CombinedId, error) {
- return obj.CombinedId(), nil
-}
-
-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(_ context.Context, obj *bug.CreateTimelineItem) (*time.Time, error) {
- t := obj.LastEdit.Time()
- return &t, nil
-}
-
-var _ graph.LabelChangeTimelineItemResolver = labelChangeTimelineItem{}
-
-type labelChangeTimelineItem struct{}
-
-func (labelChangeTimelineItem) ID(_ context.Context, obj *bug.LabelChangeTimelineItem) (entity.CombinedId, error) {
- return obj.CombinedId(), nil
-}
-
-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
-}
-
-var _ graph.SetStatusTimelineItemResolver = setStatusTimelineItem{}
-
-type setStatusTimelineItem struct{}
-
-func (setStatusTimelineItem) ID(_ context.Context, obj *bug.SetStatusTimelineItem) (entity.CombinedId, error) {
- return obj.CombinedId(), nil
-}
-
-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
-}
-
-var _ graph.SetTitleTimelineItemResolver = setTitleTimelineItem{}
-
-type setTitleTimelineItem struct{}
-
-func (setTitleTimelineItem) ID(_ context.Context, obj *bug.SetTitleTimelineItem) (entity.CombinedId, error) {
- return obj.CombinedId(), nil
-}
-
-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
-}