aboutsummaryrefslogtreecommitdiffstats
path: root/graphql/resolvers/mutation.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-04-10 01:48:53 +0200
committerGitHub <noreply@github.com>2019-04-10 01:48:53 +0200
commit9722d7c9eca28b1710e50ac9075fd11d0db0606a (patch)
treee46d372dcd1e68fb067101778eb0a5f13f745ad0 /graphql/resolvers/mutation.go
parent30efc99f4493f3a09e94bf322cbf8ef844beea13 (diff)
parent4d14cadde45ac807afcbfd37200e86c4de6bf8db (diff)
downloadgit-bug-9722d7c9eca28b1710e50ac9075fd11d0db0606a.tar.gz
Merge pull request #123 from A-Hilaly/graphql
Upgrade gqlgen version to 0.8.3
Diffstat (limited to 'graphql/resolvers/mutation.go')
-rw-r--r--graphql/resolvers/mutation.go82
1 files changed, 34 insertions, 48 deletions
diff --git a/graphql/resolvers/mutation.go b/graphql/resolvers/mutation.go
index 73d39da8..d10d2ea3 100644
--- a/graphql/resolvers/mutation.go
+++ b/graphql/resolvers/mutation.go
@@ -23,144 +23,130 @@ func (r mutationResolver) getRepo(repoRef *string) (*cache.RepoCache, error) {
return r.cache.DefaultRepo()
}
-func (r mutationResolver) NewBug(ctx context.Context, repoRef *string, title string, message string, files []git.Hash) (bug.Snapshot, error) {
+func (r mutationResolver) NewBug(ctx context.Context, repoRef *string, title string, message string, files []git.Hash) (*bug.Snapshot, error) {
repo, err := r.getRepo(repoRef)
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
b, err := repo.NewBugWithFiles(title, message, files)
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
- snap := b.Snapshot()
-
- return *snap, nil
+ return b.Snapshot(), nil
}
-func (r mutationResolver) Commit(ctx context.Context, repoRef *string, prefix string) (bug.Snapshot, error) {
+func (r mutationResolver) Commit(ctx context.Context, repoRef *string, prefix string) (*bug.Snapshot, error) {
repo, err := r.getRepo(repoRef)
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
b, err := repo.ResolveBugPrefix(prefix)
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
err = b.Commit()
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
- snap := b.Snapshot()
-
- return *snap, nil
+ return b.Snapshot(), nil
}
-func (r mutationResolver) AddComment(ctx context.Context, repoRef *string, prefix string, message string, files []git.Hash) (bug.Snapshot, error) {
+func (r mutationResolver) AddComment(ctx context.Context, repoRef *string, prefix string, message string, files []git.Hash) (*bug.Snapshot, error) {
repo, err := r.getRepo(repoRef)
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
b, err := repo.ResolveBugPrefix(prefix)
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
_, err = b.AddCommentWithFiles(message, files)
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
- snap := b.Snapshot()
-
- return *snap, nil
+ return b.Snapshot(), nil
}
-func (r mutationResolver) ChangeLabels(ctx context.Context, repoRef *string, prefix string, added []string, removed []string) (bug.Snapshot, error) {
+func (r mutationResolver) ChangeLabels(ctx context.Context, repoRef *string, prefix string, added []string, removed []string) (*bug.Snapshot, error) {
repo, err := r.getRepo(repoRef)
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
b, err := repo.ResolveBugPrefix(prefix)
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
_, _, err = b.ChangeLabels(added, removed)
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
- snap := b.Snapshot()
-
- return *snap, nil
+ return b.Snapshot(), nil
}
-func (r mutationResolver) Open(ctx context.Context, repoRef *string, prefix string) (bug.Snapshot, error) {
+func (r mutationResolver) Open(ctx context.Context, repoRef *string, prefix string) (*bug.Snapshot, error) {
repo, err := r.getRepo(repoRef)
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
b, err := repo.ResolveBugPrefix(prefix)
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
_, err = b.Open()
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
- snap := b.Snapshot()
-
- return *snap, nil
+ return b.Snapshot(), nil
}
-func (r mutationResolver) Close(ctx context.Context, repoRef *string, prefix string) (bug.Snapshot, error) {
+func (r mutationResolver) Close(ctx context.Context, repoRef *string, prefix string) (*bug.Snapshot, error) {
repo, err := r.getRepo(repoRef)
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
b, err := repo.ResolveBugPrefix(prefix)
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
_, err = b.Close()
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
- snap := b.Snapshot()
-
- return *snap, nil
+ return b.Snapshot(), nil
}
-func (r mutationResolver) SetTitle(ctx context.Context, repoRef *string, prefix string, title string) (bug.Snapshot, error) {
+func (r mutationResolver) SetTitle(ctx context.Context, repoRef *string, prefix string, title string) (*bug.Snapshot, error) {
repo, err := r.getRepo(repoRef)
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
b, err := repo.ResolveBugPrefix(prefix)
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
_, err = b.SetTitle(title)
if err != nil {
- return bug.Snapshot{}, err
+ return nil, err
}
- snap := b.Snapshot()
-
- return *snap, nil
+ return b.Snapshot(), nil
}