Skip to content

Commit

Permalink
Add control categories
Browse files Browse the repository at this point in the history
Signed-off-by: gearnode <bryan@frimin.fr>
  • Loading branch information
gearnode committed Feb 13, 2025
1 parent bd7fb97 commit 72d4b09
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/api/console/v1/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ type ControlEdge {

type Control implements Node {
id: ID!
category: String!
name: String!
description: String!
state: ControlState!
Expand Down
54 changes: 54 additions & 0 deletions pkg/api/console/v1/schema/schema.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/api/console/v1/types/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func NewControlEdge(c *coredata.Control) *ControlEdge {
func NewControl(c *coredata.Control) *Control {
return &Control{
ID: c.ID,
Category: c.Category,
Name: c.Name,
Description: c.Description,
State: c.State,
Expand Down
1 change: 1 addition & 0 deletions pkg/api/console/v1/types/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/probo/coredata/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type (
Control struct {
ID gid.GID
FrameworkID gid.GID
Category string
Name string
Description string
State ControlState
Expand All @@ -50,6 +51,7 @@ func (c *Control) scan(r pgx.Row) error {
return r.Scan(
&c.ID,
&c.FrameworkID,
&c.Category,
&c.Name,
&c.Description,
&c.State,
Expand Down Expand Up @@ -82,6 +84,7 @@ WITH control_states AS (
SELECT
id,
framework_id,
category,
name,
description,
cs.to_state AS state,
Expand Down Expand Up @@ -125,6 +128,7 @@ INSERT INTO
controls (
id,
control_id,
category,
name,
description,
content_ref,
Expand Down Expand Up @@ -179,6 +183,7 @@ WITH control_states AS (
SELECT
id,
framework_id,
category,
name,
description,
cs.to_state AS state,
Expand Down
5 changes: 5 additions & 0 deletions pkg/probo/coredata/migrations/20250212T174900Z.sql
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 72d4b09

Please sign in to comment.