Add control state transitions graphql resolver

Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
gearnode
2025-01-27 19:02:10 +01:00
parent 6631543824
commit 9a191d7ee1
9 changed files with 1211 additions and 31 deletions

View File

@@ -16,6 +16,18 @@ import (
"github.com/vektah/gqlparser/v2/gqlerror"
)
// StateTransisions is the resolver for the stateTransisions field.
func (r *controlResolver) StateTransisions(ctx context.Context, obj *types.Control, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.ControlStateTransitionConnection, error) {
cursor := types.NewCursor(first, after, last, before)
page, err := r.svc.ListControlStateTransitions(ctx, obj.ID, cursor)
if err != nil {
return nil, fmt.Errorf("cannot list control tasks: %w", err)
}
return types.NewControlStateTransitionConnection(page), nil
}
// Tasks is the resolver for the tasks field.
func (r *controlResolver) Tasks(ctx context.Context, obj *types.Control, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.TaskConnection, error) {
cursor := types.NewCursor(first, after, last, before)