-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.resolvers.go
33 lines (27 loc) · 980 Bytes
/
deploy.resolvers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package graph
// This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end.
// Code generated by github.com/99designs/gqlgen
import (
"context"
"fmt"
"github.com/nais/api/internal/graph/model"
"github.com/nais/api/internal/thirdparty/hookd"
)
// Deployments is the resolver for the deployments field.
func (r *queryResolver) Deployments(ctx context.Context, offset *int, limit *int) (*model.DeploymentList, error) {
l := 100
if limit != nil {
l = *limit
}
deploys, err := r.hookdClient.Deployments(ctx, hookd.WithLimit(l), hookd.WithIgnoreTeams("nais-verification"))
if err != nil {
return nil, fmt.Errorf("getting deploys from Hookd: %w", err)
}
pagination := model.NewPagination(offset, limit)
n, pi := model.PaginatedSlice(deploys, pagination)
return &model.DeploymentList{
Nodes: deployToModel(n),
PageInfo: pi,
}, nil
}