aboutsummaryrefslogtreecommitdiffstats
path: root/api/graphql/resolvers
diff options
context:
space:
mode:
Diffstat (limited to 'api/graphql/resolvers')
-rw-r--r--api/graphql/resolvers/bug.go6
-rw-r--r--api/graphql/resolvers/comment.go2
-rw-r--r--api/graphql/resolvers/label.go25
-rw-r--r--api/graphql/resolvers/mutation.go2
-rw-r--r--api/graphql/resolvers/operations.go18
-rw-r--r--api/graphql/resolvers/repo.go2
-rw-r--r--api/graphql/resolvers/root.go4
-rw-r--r--api/graphql/resolvers/timeline.go6
8 files changed, 7 insertions, 58 deletions
diff --git a/api/graphql/resolvers/bug.go b/api/graphql/resolvers/bug.go
index 18c8d7f4..d17a4469 100644
--- a/api/graphql/resolvers/bug.go
+++ b/api/graphql/resolvers/bug.go
@@ -6,7 +6,7 @@ import (
"github.com/MichaelMure/git-bug/api/graphql/connections"
"github.com/MichaelMure/git-bug/api/graphql/graph"
"github.com/MichaelMure/git-bug/api/graphql/models"
- "github.com/MichaelMure/git-bug/bug"
+ "github.com/MichaelMure/git-bug/entities/bug"
"github.com/MichaelMure/git-bug/entity/dag"
)
@@ -22,10 +22,6 @@ func (bugResolver) HumanID(_ context.Context, obj models.BugWrapper) (string, er
return obj.Id().Human(), nil
}
-func (bugResolver) Status(_ context.Context, obj models.BugWrapper) (models.Status, error) {
- return convertStatus(obj.Status())
-}
-
func (bugResolver) Comments(_ context.Context, obj models.BugWrapper, after *string, before *string, first *int, last *int) (*models.CommentConnection, error) {
input := models.ConnectionInput{
Before: before,
diff --git a/api/graphql/resolvers/comment.go b/api/graphql/resolvers/comment.go
index 5206e8a7..78548156 100644
--- a/api/graphql/resolvers/comment.go
+++ b/api/graphql/resolvers/comment.go
@@ -5,7 +5,7 @@ import (
"github.com/MichaelMure/git-bug/api/graphql/graph"
"github.com/MichaelMure/git-bug/api/graphql/models"
- "github.com/MichaelMure/git-bug/bug"
+ "github.com/MichaelMure/git-bug/entities/bug"
)
var _ graph.CommentResolver = &commentResolver{}
diff --git a/api/graphql/resolvers/label.go b/api/graphql/resolvers/label.go
index 83e95029..5210dcc9 100644
--- a/api/graphql/resolvers/label.go
+++ b/api/graphql/resolvers/label.go
@@ -2,12 +2,10 @@ package resolvers
import (
"context"
- "fmt"
"image/color"
"github.com/MichaelMure/git-bug/api/graphql/graph"
- "github.com/MichaelMure/git-bug/api/graphql/models"
- "github.com/MichaelMure/git-bug/bug"
+ "github.com/MichaelMure/git-bug/entities/bug"
)
var _ graph.LabelResolver = &labelResolver{}
@@ -22,24 +20,3 @@ func (labelResolver) Color(ctx context.Context, obj *bug.Label) (*color.RGBA, er
rgba := obj.Color().RGBA()
return &rgba, nil
}
-
-var _ graph.LabelChangeResultResolver = &labelChangeResultResolver{}
-
-type labelChangeResultResolver struct{}
-
-func (labelChangeResultResolver) Status(ctx context.Context, obj *bug.LabelChangeResult) (models.LabelChangeStatus, error) {
- switch obj.Status {
- case bug.LabelChangeAdded:
- return models.LabelChangeStatusAdded, nil
- case bug.LabelChangeRemoved:
- return models.LabelChangeStatusRemoved, nil
- case bug.LabelChangeDuplicateInOp:
- return models.LabelChangeStatusDuplicateInOp, nil
- case bug.LabelChangeAlreadySet:
- return models.LabelChangeStatusAlreadyExist, nil
- case bug.LabelChangeDoesntExist:
- return models.LabelChangeStatusDoesntExist, nil
- }
-
- return "", fmt.Errorf("unknown status")
-}
diff --git a/api/graphql/resolvers/mutation.go b/api/graphql/resolvers/mutation.go
index aa99e93d..6ad81db4 100644
--- a/api/graphql/resolvers/mutation.go
+++ b/api/graphql/resolvers/mutation.go
@@ -7,8 +7,8 @@ import (
"github.com/MichaelMure/git-bug/api/auth"
"github.com/MichaelMure/git-bug/api/graphql/graph"
"github.com/MichaelMure/git-bug/api/graphql/models"
- "github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/entities/bug"
"github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/util/text"
)
diff --git a/api/graphql/resolvers/operations.go b/api/graphql/resolvers/operations.go
index 0ede9f13..53c3c0bc 100644
--- a/api/graphql/resolvers/operations.go
+++ b/api/graphql/resolvers/operations.go
@@ -2,12 +2,11 @@ package resolvers
import (
"context"
- "fmt"
"time"
"github.com/MichaelMure/git-bug/api/graphql/graph"
"github.com/MichaelMure/git-bug/api/graphql/models"
- "github.com/MichaelMure/git-bug/bug"
+ "github.com/MichaelMure/git-bug/entities/bug"
)
var _ graph.CreateOperationResolver = createOperationResolver{}
@@ -99,10 +98,6 @@ func (setStatusOperationResolver) Date(_ context.Context, obj *bug.SetStatusOper
return &t, nil
}
-func (setStatusOperationResolver) Status(_ context.Context, obj *bug.SetStatusOperation) (models.Status, error) {
- return convertStatus(obj.Status)
-}
-
var _ graph.SetTitleOperationResolver = setTitleOperationResolver{}
type setTitleOperationResolver struct{}
@@ -119,14 +114,3 @@ func (setTitleOperationResolver) Date(_ context.Context, obj *bug.SetTitleOperat
t := obj.Time()
return &t, nil
}
-
-func convertStatus(status bug.Status) (models.Status, error) {
- switch status {
- case bug.OpenStatus:
- return models.StatusOpen, nil
- case bug.ClosedStatus:
- return models.StatusClosed, nil
- }
-
- return "", fmt.Errorf("unknown status")
-}
diff --git a/api/graphql/resolvers/repo.go b/api/graphql/resolvers/repo.go
index c2163cbe..3fcaada1 100644
--- a/api/graphql/resolvers/repo.go
+++ b/api/graphql/resolvers/repo.go
@@ -7,7 +7,7 @@ import (
"github.com/MichaelMure/git-bug/api/graphql/connections"
"github.com/MichaelMure/git-bug/api/graphql/graph"
"github.com/MichaelMure/git-bug/api/graphql/models"
- "github.com/MichaelMure/git-bug/bug"
+ "github.com/MichaelMure/git-bug/entities/bug"
"github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/query"
)
diff --git a/api/graphql/resolvers/root.go b/api/graphql/resolvers/root.go
index bb3bf5cf..44ae010e 100644
--- a/api/graphql/resolvers/root.go
+++ b/api/graphql/resolvers/root.go
@@ -101,7 +101,3 @@ func (RootResolver) SetStatusOperation() graph.SetStatusOperationResolver {
func (RootResolver) SetTitleOperation() graph.SetTitleOperationResolver {
return &setTitleOperationResolver{}
}
-
-func (r RootResolver) LabelChangeResult() graph.LabelChangeResultResolver {
- return &labelChangeResultResolver{}
-}
diff --git a/api/graphql/resolvers/timeline.go b/api/graphql/resolvers/timeline.go
index 3223b3a0..2481784e 100644
--- a/api/graphql/resolvers/timeline.go
+++ b/api/graphql/resolvers/timeline.go
@@ -6,7 +6,7 @@ import (
"github.com/MichaelMure/git-bug/api/graphql/graph"
"github.com/MichaelMure/git-bug/api/graphql/models"
- "github.com/MichaelMure/git-bug/bug"
+ "github.com/MichaelMure/git-bug/entities/bug"
)
var _ graph.CommentHistoryStepResolver = commentHistoryStepResolver{}
@@ -96,10 +96,6 @@ func (setStatusTimelineItem) Date(_ context.Context, obj *bug.SetStatusTimelineI
return &t, nil
}
-func (setStatusTimelineItem) Status(_ context.Context, obj *bug.SetStatusTimelineItem) (models.Status, error) {
- return convertStatus(obj.Status)
-}
-
var _ graph.SetTitleTimelineItemResolver = setTitleTimelineItem{}
type setTitleTimelineItem struct{}