@@ -157,6 +157,7 @@ type ControlEdge {
|
|||||||
|
|
||||||
type Control implements Node {
|
type Control implements Node {
|
||||||
id: ID!
|
id: ID!
|
||||||
|
category: String!
|
||||||
name: String!
|
name: String!
|
||||||
description: String!
|
description: String!
|
||||||
state: ControlState!
|
state: ControlState!
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ type DirectiveRoot struct {
|
|||||||
|
|
||||||
type ComplexityRoot struct {
|
type ComplexityRoot struct {
|
||||||
Control struct {
|
Control struct {
|
||||||
|
Category func(childComplexity int) int
|
||||||
CreatedAt func(childComplexity int) int
|
CreatedAt func(childComplexity int) int
|
||||||
Description func(childComplexity int) int
|
Description func(childComplexity int) int
|
||||||
ID func(childComplexity int) int
|
ID func(childComplexity int) int
|
||||||
@@ -309,6 +310,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
|
|||||||
_ = ec
|
_ = ec
|
||||||
switch typeName + "." + field {
|
switch typeName + "." + field {
|
||||||
|
|
||||||
|
case "Control.category":
|
||||||
|
if e.complexity.Control.Category == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.Control.Category(childComplexity), true
|
||||||
|
|
||||||
case "Control.createdAt":
|
case "Control.createdAt":
|
||||||
if e.complexity.Control.CreatedAt == nil {
|
if e.complexity.Control.CreatedAt == nil {
|
||||||
break
|
break
|
||||||
@@ -1431,6 +1439,7 @@ type ControlEdge {
|
|||||||
|
|
||||||
type Control implements Node {
|
type Control implements Node {
|
||||||
id: ID!
|
id: ID!
|
||||||
|
category: String!
|
||||||
name: String!
|
name: String!
|
||||||
description: String!
|
description: String!
|
||||||
state: ControlState!
|
state: ControlState!
|
||||||
@@ -2532,6 +2541,44 @@ func (ec *executionContext) fieldContext_Control_id(_ context.Context, field gra
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) _Control_category(ctx context.Context, field graphql.CollectedField, obj *types.Control) (ret graphql.Marshaler) {
|
||||||
|
fc, err := ec.fieldContext_Control_category(ctx, field)
|
||||||
|
if err != nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
ctx = graphql.WithFieldContext(ctx, fc)
|
||||||
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
||||||
|
ctx = rctx // use context from middleware stack in children
|
||||||
|
return obj.Category, nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
ec.Error(ctx, err)
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
if resTmp == nil {
|
||||||
|
if !graphql.HasFieldError(ctx, fc) {
|
||||||
|
ec.Errorf(ctx, "must not be null")
|
||||||
|
}
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
res := resTmp.(string)
|
||||||
|
fc.Result = res
|
||||||
|
return ec.marshalNString2string(ctx, field.Selections, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) fieldContext_Control_category(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
|
fc = &graphql.FieldContext{
|
||||||
|
Object: "Control",
|
||||||
|
Field: field,
|
||||||
|
IsMethod: false,
|
||||||
|
IsResolver: false,
|
||||||
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
|
return nil, errors.New("field of type String does not have child fields")
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return fc, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _Control_name(ctx context.Context, field graphql.CollectedField, obj *types.Control) (ret graphql.Marshaler) {
|
func (ec *executionContext) _Control_name(ctx context.Context, field graphql.CollectedField, obj *types.Control) (ret graphql.Marshaler) {
|
||||||
fc, err := ec.fieldContext_Control_name(ctx, field)
|
fc, err := ec.fieldContext_Control_name(ctx, field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -2985,6 +3032,8 @@ func (ec *executionContext) fieldContext_ControlEdge_node(_ context.Context, fie
|
|||||||
switch field.Name {
|
switch field.Name {
|
||||||
case "id":
|
case "id":
|
||||||
return ec.fieldContext_Control_id(ctx, field)
|
return ec.fieldContext_Control_id(ctx, field)
|
||||||
|
case "category":
|
||||||
|
return ec.fieldContext_Control_category(ctx, field)
|
||||||
case "name":
|
case "name":
|
||||||
return ec.fieldContext_Control_name(ctx, field)
|
return ec.fieldContext_Control_name(ctx, field)
|
||||||
case "description":
|
case "description":
|
||||||
@@ -9036,6 +9085,11 @@ func (ec *executionContext) _Control(ctx context.Context, sel ast.SelectionSet,
|
|||||||
if out.Values[i] == graphql.Null {
|
if out.Values[i] == graphql.Null {
|
||||||
atomic.AddUint32(&out.Invalids, 1)
|
atomic.AddUint32(&out.Invalids, 1)
|
||||||
}
|
}
|
||||||
|
case "category":
|
||||||
|
out.Values[i] = ec._Control_category(ctx, field, obj)
|
||||||
|
if out.Values[i] == graphql.Null {
|
||||||
|
atomic.AddUint32(&out.Invalids, 1)
|
||||||
|
}
|
||||||
case "name":
|
case "name":
|
||||||
out.Values[i] = ec._Control_name(ctx, field, obj)
|
out.Values[i] = ec._Control_name(ctx, field, obj)
|
||||||
if out.Values[i] == graphql.Null {
|
if out.Values[i] == graphql.Null {
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ func NewControlEdge(c *coredata.Control) *ControlEdge {
|
|||||||
func NewControl(c *coredata.Control) *Control {
|
func NewControl(c *coredata.Control) *Control {
|
||||||
return &Control{
|
return &Control{
|
||||||
ID: c.ID,
|
ID: c.ID,
|
||||||
|
Category: c.Category,
|
||||||
Name: c.Name,
|
Name: c.Name,
|
||||||
Description: c.Description,
|
Description: c.Description,
|
||||||
State: c.State,
|
State: c.State,
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ type Node interface {
|
|||||||
|
|
||||||
type Control struct {
|
type Control struct {
|
||||||
ID gid.GID `json:"id"`
|
ID gid.GID `json:"id"`
|
||||||
|
Category string `json:"category"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
State coredata.ControlState `json:"state"`
|
State coredata.ControlState `json:"state"`
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ type (
|
|||||||
Control struct {
|
Control struct {
|
||||||
ID gid.GID
|
ID gid.GID
|
||||||
FrameworkID gid.GID
|
FrameworkID gid.GID
|
||||||
|
Category string
|
||||||
Name string
|
Name string
|
||||||
Description string
|
Description string
|
||||||
State ControlState
|
State ControlState
|
||||||
@@ -50,6 +51,7 @@ func (c *Control) scan(r pgx.Row) error {
|
|||||||
return r.Scan(
|
return r.Scan(
|
||||||
&c.ID,
|
&c.ID,
|
||||||
&c.FrameworkID,
|
&c.FrameworkID,
|
||||||
|
&c.Category,
|
||||||
&c.Name,
|
&c.Name,
|
||||||
&c.Description,
|
&c.Description,
|
||||||
&c.State,
|
&c.State,
|
||||||
@@ -82,6 +84,7 @@ WITH control_states AS (
|
|||||||
SELECT
|
SELECT
|
||||||
id,
|
id,
|
||||||
framework_id,
|
framework_id,
|
||||||
|
category,
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
cs.to_state AS state,
|
cs.to_state AS state,
|
||||||
@@ -125,6 +128,7 @@ INSERT INTO
|
|||||||
controls (
|
controls (
|
||||||
id,
|
id,
|
||||||
control_id,
|
control_id,
|
||||||
|
category,
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
content_ref,
|
content_ref,
|
||||||
@@ -179,6 +183,7 @@ WITH control_states AS (
|
|||||||
SELECT
|
SELECT
|
||||||
id,
|
id,
|
||||||
framework_id,
|
framework_id,
|
||||||
|
category,
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
cs.to_state AS state,
|
cs.to_state AS state,
|
||||||
|
|||||||
5
pkg/probo/coredata/migrations/20250212T174900Z.sql
Normal file
5
pkg/probo/coredata/migrations/20250212T174900Z.sql
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
ALTER TABLE controls ADD COLUMN category TEXT;
|
||||||
|
|
||||||
|
UPDATE controls SET category = 'security';
|
||||||
|
|
||||||
|
ALTER TABLE controls ALTER COLUMN category SET NOT NULL;
|
||||||
Reference in New Issue
Block a user