aboutsummaryrefslogtreecommitdiffstats
path: root/graphql/resolvers/mutation.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-02-03 21:03:48 +0100
committerMichael Muré <batolettre@gmail.com>2020-02-09 02:18:44 +0100
commit81f5c3e0af9aa4b81662e0781289189703324986 (patch)
treebe229ccfb135445bf5355b1e8506d870af5f472b /graphql/resolvers/mutation.go
parent9e1a987b4d94dc5c2115423ede5954d4faf1d342 (diff)
downloadgit-bug-81f5c3e0af9aa4b81662e0781289189703324986.tar.gz
graphql: use the cache in priority for fast browsing at < 20ms instead of seconds
Diffstat (limited to 'graphql/resolvers/mutation.go')
-rw-r--r--graphql/resolvers/mutation.go32
1 files changed, 16 insertions, 16 deletions
diff --git a/graphql/resolvers/mutation.go b/graphql/resolvers/mutation.go
index b4f8845a..889edbc8 100644
--- a/graphql/resolvers/mutation.go
+++ b/graphql/resolvers/mutation.go
@@ -23,7 +23,7 @@ func (r mutationResolver) getRepo(ref *string) (*cache.RepoCache, error) {
return r.cache.DefaultRepo()
}
-func (r mutationResolver) NewBug(ctx context.Context, input models.NewBugInput) (*models.NewBugPayload, error) {
+func (r mutationResolver) NewBug(_ context.Context, input models.NewBugInput) (*models.NewBugPayload, error) {
repo, err := r.getRepo(input.RepoRef)
if err != nil {
return nil, err
@@ -36,12 +36,12 @@ func (r mutationResolver) NewBug(ctx context.Context, input models.NewBugInput)
return &models.NewBugPayload{
ClientMutationID: input.ClientMutationID,
- Bug: b.Snapshot(),
+ Bug: models.NewLoadedBug(b.Snapshot()),
Operation: op,
}, nil
}
-func (r mutationResolver) AddComment(ctx context.Context, input models.AddCommentInput) (*models.AddCommentPayload, error) {
+func (r mutationResolver) AddComment(_ context.Context, input models.AddCommentInput) (*models.AddCommentPayload, error) {
repo, err := r.getRepo(input.RepoRef)
if err != nil {
return nil, err
@@ -59,12 +59,12 @@ func (r mutationResolver) AddComment(ctx context.Context, input models.AddCommen
return &models.AddCommentPayload{
ClientMutationID: input.ClientMutationID,
- Bug: b.Snapshot(),
+ Bug: models.NewLoadedBug(b.Snapshot()),
Operation: op,
}, nil
}
-func (r mutationResolver) ChangeLabels(ctx context.Context, input *models.ChangeLabelInput) (*models.ChangeLabelPayload, error) {
+func (r mutationResolver) ChangeLabels(_ context.Context, input *models.ChangeLabelInput) (*models.ChangeLabelPayload, error) {
repo, err := r.getRepo(input.RepoRef)
if err != nil {
return nil, err
@@ -87,13 +87,13 @@ func (r mutationResolver) ChangeLabels(ctx context.Context, input *models.Change
return &models.ChangeLabelPayload{
ClientMutationID: input.ClientMutationID,
- Bug: b.Snapshot(),
+ Bug: models.NewLoadedBug(b.Snapshot()),
Operation: op,
Results: resultsPtr,
}, nil
}
-func (r mutationResolver) OpenBug(ctx context.Context, input models.OpenBugInput) (*models.OpenBugPayload, error) {
+func (r mutationResolver) OpenBug(_ context.Context, input models.OpenBugInput) (*models.OpenBugPayload, error) {
repo, err := r.getRepo(input.RepoRef)
if err != nil {
return nil, err
@@ -111,12 +111,12 @@ func (r mutationResolver) OpenBug(ctx context.Context, input models.OpenBugInput
return &models.OpenBugPayload{
ClientMutationID: input.ClientMutationID,
- Bug: b.Snapshot(),
+ Bug: models.NewLoadedBug(b.Snapshot()),
Operation: op,
}, nil
}
-func (r mutationResolver) CloseBug(ctx context.Context, input models.CloseBugInput) (*models.CloseBugPayload, error) {
+func (r mutationResolver) CloseBug(_ context.Context, input models.CloseBugInput) (*models.CloseBugPayload, error) {
repo, err := r.getRepo(input.RepoRef)
if err != nil {
return nil, err
@@ -134,12 +134,12 @@ func (r mutationResolver) CloseBug(ctx context.Context, input models.CloseBugInp
return &models.CloseBugPayload{
ClientMutationID: input.ClientMutationID,
- Bug: b.Snapshot(),
+ Bug: models.NewLoadedBug(b.Snapshot()),
Operation: op,
}, nil
}
-func (r mutationResolver) SetTitle(ctx context.Context, input models.SetTitleInput) (*models.SetTitlePayload, error) {
+func (r mutationResolver) SetTitle(_ context.Context, input models.SetTitleInput) (*models.SetTitlePayload, error) {
repo, err := r.getRepo(input.RepoRef)
if err != nil {
return nil, err
@@ -157,12 +157,12 @@ func (r mutationResolver) SetTitle(ctx context.Context, input models.SetTitleInp
return &models.SetTitlePayload{
ClientMutationID: input.ClientMutationID,
- Bug: b.Snapshot(),
+ Bug: models.NewLoadedBug(b.Snapshot()),
Operation: op,
}, nil
}
-func (r mutationResolver) Commit(ctx context.Context, input models.CommitInput) (*models.CommitPayload, error) {
+func (r mutationResolver) Commit(_ context.Context, input models.CommitInput) (*models.CommitPayload, error) {
repo, err := r.getRepo(input.RepoRef)
if err != nil {
return nil, err
@@ -180,11 +180,11 @@ func (r mutationResolver) Commit(ctx context.Context, input models.CommitInput)
return &models.CommitPayload{
ClientMutationID: input.ClientMutationID,
- Bug: b.Snapshot(),
+ Bug: models.NewLoadedBug(b.Snapshot()),
}, nil
}
-func (r mutationResolver) CommitAsNeeded(ctx context.Context, input models.CommitAsNeededInput) (*models.CommitAsNeededPayload, error) {
+func (r mutationResolver) CommitAsNeeded(_ context.Context, input models.CommitAsNeededInput) (*models.CommitAsNeededPayload, error) {
repo, err := r.getRepo(input.RepoRef)
if err != nil {
return nil, err
@@ -202,6 +202,6 @@ func (r mutationResolver) CommitAsNeeded(ctx context.Context, input models.Commi
return &models.CommitAsNeededPayload{
ClientMutationID: input.ClientMutationID,
- Bug: b.Snapshot(),
+ Bug: models.NewLoadedBug(b.Snapshot()),
}, nil
}