aboutsummaryrefslogtreecommitdiffstats
path: root/graphql/resolvers
diff options
context:
space:
mode:
Diffstat (limited to 'graphql/resolvers')
-rw-r--r--graphql/resolvers/bug.go18
-rw-r--r--graphql/resolvers/repo.go20
2 files changed, 21 insertions, 17 deletions
diff --git a/graphql/resolvers/bug.go b/graphql/resolvers/bug.go
index 2ad2310b..37766b95 100644
--- a/graphql/resolvers/bug.go
+++ b/graphql/resolvers/bug.go
@@ -29,15 +29,19 @@ func (bugResolver) Comments(ctx context.Context, obj *bug.Snapshot, after *strin
edger := func(comment bug.Comment, offset int) connections.Edge {
return models.CommentEdge{
- Node: comment,
+ 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.CommentEdge, nodes []bug.Comment, info *models.PageInfo, totalCount int) (*models.CommentConnection, error) {
+ var commentNodes []*bug.Comment
+ for _, c := range nodes {
+ commentNodes = append(commentNodes, &c)
+ }
return &models.CommentConnection{
Edges: edges,
- Nodes: nodes,
+ Nodes: commentNodes,
PageInfo: info,
TotalCount: totalCount,
}, nil
@@ -61,7 +65,7 @@ func (bugResolver) Operations(ctx context.Context, obj *bug.Snapshot, after *str
}
}
- conMaker := func(edges []models.OperationEdge, nodes []bug.Operation, info models.PageInfo, totalCount int) (*models.OperationConnection, error) {
+ conMaker := func(edges []*models.OperationEdge, nodes []bug.Operation, info *models.PageInfo, totalCount int) (*models.OperationConnection, error) {
return &models.OperationConnection{
Edges: edges,
Nodes: nodes,
@@ -88,7 +92,7 @@ func (bugResolver) Timeline(ctx context.Context, obj *bug.Snapshot, after *strin
}
}
- conMaker := func(edges []models.TimelineItemEdge, nodes []bug.TimelineItem, info models.PageInfo, totalCount int) (*models.TimelineItemConnection, error) {
+ conMaker := func(edges []*models.TimelineItemEdge, nodes []bug.TimelineItem, info *models.PageInfo, totalCount int) (*models.TimelineItemConnection, error) {
return &models.TimelineItemConnection{
Edges: edges,
Nodes: nodes,
@@ -120,7 +124,7 @@ func (bugResolver) Actors(ctx context.Context, obj *bug.Snapshot, after *string,
}
}
- conMaker := func(edges []models.IdentityEdge, nodes []identity.Interface, info models.PageInfo, totalCount int) (*models.IdentityConnection, error) {
+ conMaker := func(edges []*models.IdentityEdge, nodes []identity.Interface, info *models.PageInfo, totalCount int) (*models.IdentityConnection, error) {
return &models.IdentityConnection{
Edges: edges,
Nodes: nodes,
@@ -147,7 +151,7 @@ func (bugResolver) Participants(ctx context.Context, obj *bug.Snapshot, after *s
}
}
- conMaker := func(edges []models.IdentityEdge, nodes []identity.Interface, info models.PageInfo, totalCount int) (*models.IdentityConnection, error) {
+ conMaker := func(edges []*models.IdentityEdge, nodes []identity.Interface, info *models.PageInfo, totalCount int) (*models.IdentityConnection, error) {
return &models.IdentityConnection{
Edges: edges,
Nodes: nodes,
diff --git a/graphql/resolvers/repo.go b/graphql/resolvers/repo.go
index 87edad9a..68a3ce0a 100644
--- a/graphql/resolvers/repo.go
+++ b/graphql/resolvers/repo.go
@@ -46,9 +46,9 @@ func (repoResolver) AllBugs(ctx context.Context, obj *models.Repository, after *
}
// The conMaker will finally load and compile bugs from git to replace the selected edges
- conMaker := func(lazyBugEdges []connections.LazyBugEdge, lazyNode []string, info models.PageInfo, totalCount int) (*models.BugConnection, error) {
- edges := make([]models.BugEdge, len(lazyBugEdges))
- nodes := make([]bug.Snapshot, len(lazyBugEdges))
+ conMaker := func(lazyBugEdges []*connections.LazyBugEdge, lazyNode []string, info *models.PageInfo, totalCount int) (*models.BugConnection, error) {
+ edges := make([]*models.BugEdge, len(lazyBugEdges))
+ nodes := make([]*bug.Snapshot, len(lazyBugEdges))
for i, lazyBugEdge := range lazyBugEdges {
b, err := obj.Repo.ResolveBug(lazyBugEdge.Id)
@@ -59,11 +59,11 @@ func (repoResolver) AllBugs(ctx context.Context, obj *models.Repository, after *
snap := b.Snapshot()
- edges[i] = models.BugEdge{
+ edges[i] = &models.BugEdge{
Cursor: lazyBugEdge.Cursor,
- Node: *snap,
+ Node: snap,
}
- nodes[i] = *snap
+ nodes[i] = snap
}
return &models.BugConnection{
@@ -107,8 +107,8 @@ func (repoResolver) AllIdentities(ctx context.Context, obj *models.Repository, a
}
// The conMaker will finally load and compile identities from git to replace the selected edges
- conMaker := func(lazyIdentityEdges []connections.LazyIdentityEdge, lazyNode []string, info models.PageInfo, totalCount int) (*models.IdentityConnection, error) {
- edges := make([]models.IdentityEdge, len(lazyIdentityEdges))
+ conMaker := func(lazyIdentityEdges []*connections.LazyIdentityEdge, lazyNode []string, info *models.PageInfo, totalCount int) (*models.IdentityConnection, error) {
+ edges := make([]*models.IdentityEdge, len(lazyIdentityEdges))
nodes := make([]identity.Interface, len(lazyIdentityEdges))
for k, lazyIdentityEdge := range lazyIdentityEdges {
@@ -120,9 +120,9 @@ func (repoResolver) AllIdentities(ctx context.Context, obj *models.Repository, a
ii := identity.Interface(i.Identity)
- edges[k] = models.IdentityEdge{
+ edges[k] = &models.IdentityEdge{
Cursor: lazyIdentityEdge.Cursor,
- Node: ii,
+ Node: i.Identity,
}
nodes[k] = ii
}