Add controls totalCount support
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -58,6 +58,47 @@ func (c Control) CursorKey(orderBy ControlOrderField) page.CursorKey {
|
||||
panic(fmt.Sprintf("unsupported order by: %s", orderBy))
|
||||
}
|
||||
|
||||
func (c *Controls) CountByDocumentID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
scope Scoper,
|
||||
documentID gid.GID,
|
||||
filter *ControlFilter,
|
||||
) (int, error) {
|
||||
q := `
|
||||
WITH ctrl AS (
|
||||
SELECT
|
||||
c.id
|
||||
FROM
|
||||
controls c
|
||||
INNER JOIN
|
||||
controls_documents cp ON c.id = cp.control_id
|
||||
WHERE
|
||||
cp.document_id = @document_id
|
||||
)
|
||||
SELECT
|
||||
COUNT(id)
|
||||
FROM
|
||||
ctrl
|
||||
WHERE %s
|
||||
AND %s
|
||||
`
|
||||
q = fmt.Sprintf(q, scope.SQLFragment(), filter.SQLFragment())
|
||||
|
||||
args := pgx.NamedArgs{"document_id": documentID}
|
||||
maps.Copy(args, scope.SQLArguments())
|
||||
maps.Copy(args, filter.SQLArguments())
|
||||
|
||||
row := conn.QueryRow(ctx, q, args)
|
||||
|
||||
var count int
|
||||
if err := row.Scan(&count); err != nil {
|
||||
return 0, fmt.Errorf("cannot scan count: %w", err)
|
||||
}
|
||||
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (c *Controls) LoadByDocumentID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
@@ -121,6 +162,47 @@ WHERE %s
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Controls) CountByMeasureID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
scope Scoper,
|
||||
measureID gid.GID,
|
||||
filter *ControlFilter,
|
||||
) (int, error) {
|
||||
q := `
|
||||
WITH ctrl AS (
|
||||
SELECT
|
||||
c.id
|
||||
FROM
|
||||
controls c
|
||||
INNER JOIN
|
||||
controls_measures cm ON c.id = cm.control_id
|
||||
WHERE
|
||||
cm.measure_id = @measure_id
|
||||
)
|
||||
SELECT
|
||||
COUNT(id)
|
||||
FROM
|
||||
ctrl
|
||||
WHERE %s
|
||||
AND %s
|
||||
`
|
||||
q = fmt.Sprintf(q, scope.SQLFragment(), filter.SQLFragment())
|
||||
|
||||
args := pgx.NamedArgs{"measure_id": measureID}
|
||||
maps.Copy(args, scope.SQLArguments())
|
||||
maps.Copy(args, filter.SQLArguments())
|
||||
|
||||
row := conn.QueryRow(ctx, q, args)
|
||||
|
||||
var count int
|
||||
if err := row.Scan(&count); err != nil {
|
||||
return 0, fmt.Errorf("cannot scan count: %w", err)
|
||||
}
|
||||
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (c *Controls) LoadByMeasureID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
@@ -184,6 +266,53 @@ WHERE %s
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Controls) CountByRiskID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
scope Scoper,
|
||||
riskID gid.GID,
|
||||
filter *ControlFilter,
|
||||
) (int, error) {
|
||||
q := `
|
||||
WITH ctrl AS (
|
||||
SELECT DISTINCT
|
||||
c.id
|
||||
FROM
|
||||
controls c
|
||||
LEFT JOIN
|
||||
controls_documents cp ON c.id = cp.control_id
|
||||
LEFT JOIN
|
||||
risks_documents rp ON cp.document_id = rp.document_id
|
||||
LEFT JOIN
|
||||
controls_measures cm ON c.id = cm.control_id
|
||||
LEFT JOIN
|
||||
risks_measures rm ON (rm.measure_id = cm.measure_id)
|
||||
WHERE
|
||||
rp.risk_id = @risk_id OR rm.risk_id = @risk_id
|
||||
)
|
||||
SELECT
|
||||
COUNT(id)
|
||||
FROM
|
||||
ctrl
|
||||
WHERE %s
|
||||
AND %s
|
||||
`
|
||||
q = fmt.Sprintf(q, scope.SQLFragment(), filter.SQLFragment())
|
||||
|
||||
args := pgx.NamedArgs{"risk_id": riskID}
|
||||
maps.Copy(args, scope.SQLArguments())
|
||||
maps.Copy(args, filter.SQLArguments())
|
||||
|
||||
row := conn.QueryRow(ctx, q, args)
|
||||
|
||||
var count int
|
||||
if err := row.Scan(&count); err != nil {
|
||||
return 0, fmt.Errorf("cannot scan count: %w", err)
|
||||
}
|
||||
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (c *Controls) LoadByRiskID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
@@ -253,6 +382,38 @@ WHERE %s
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Controls) CountByFrameworkID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
scope Scoper,
|
||||
frameworkID gid.GID,
|
||||
filter *ControlFilter,
|
||||
) (int, error) {
|
||||
q := `
|
||||
SELECT
|
||||
COUNT(id)
|
||||
FROM
|
||||
controls
|
||||
WHERE %s
|
||||
AND framework_id = @framework_id
|
||||
AND %s
|
||||
`
|
||||
q = fmt.Sprintf(q, scope.SQLFragment(), filter.SQLFragment())
|
||||
|
||||
args := pgx.NamedArgs{"framework_id": frameworkID}
|
||||
maps.Copy(args, scope.SQLArguments())
|
||||
maps.Copy(args, filter.SQLArguments())
|
||||
|
||||
row := conn.QueryRow(ctx, q, args)
|
||||
|
||||
var count int
|
||||
if err := row.Scan(&count); err != nil {
|
||||
return 0, fmt.Errorf("cannot scan count: %w", err)
|
||||
}
|
||||
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (c *Controls) LoadByFrameworkID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
@@ -301,6 +462,53 @@ WHERE
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Controls) CountByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
scope Scoper,
|
||||
organizationID gid.GID,
|
||||
filter *ControlFilter,
|
||||
) (int, error) {
|
||||
q := `
|
||||
WITH ctrl AS (
|
||||
SELECT
|
||||
c.id,
|
||||
c.section_title,
|
||||
c.framework_id,
|
||||
c.tenant_id,
|
||||
c.name,
|
||||
c.description,
|
||||
c.created_at,
|
||||
c.updated_at
|
||||
FROM
|
||||
controls c
|
||||
INNER JOIN
|
||||
frameworks f ON c.framework_id = f.id
|
||||
WHERE
|
||||
f.organization_id = @organization_id
|
||||
)
|
||||
SELECT
|
||||
COUNT(id)
|
||||
FROM
|
||||
ctrl
|
||||
WHERE %s
|
||||
AND %s
|
||||
`
|
||||
|
||||
args := pgx.StrictNamedArgs{"organization_id": organizationID}
|
||||
maps.Copy(args, scope.SQLArguments())
|
||||
maps.Copy(args, filter.SQLArguments())
|
||||
|
||||
row := conn.QueryRow(ctx, q, args)
|
||||
|
||||
var count int
|
||||
if err := row.Scan(&count); err != nil {
|
||||
return 0, fmt.Errorf("cannot scan count: %w", err)
|
||||
}
|
||||
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (c *Controls) LoadByOrganizationID(
|
||||
ctx context.Context,
|
||||
conn pg.Conn,
|
||||
|
||||
@@ -56,6 +56,33 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
func (s ControlService) CountForDocumentID(
|
||||
ctx context.Context,
|
||||
documentID gid.GID,
|
||||
filter *coredata.ControlFilter,
|
||||
) (int, error) {
|
||||
var count int
|
||||
|
||||
err := s.svc.pg.WithConn(
|
||||
ctx,
|
||||
func(conn pg.Conn) (err error) {
|
||||
controls := &coredata.Controls{}
|
||||
count, err = controls.CountByDocumentID(ctx, conn, s.svc.scope, documentID, filter)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot count controls: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("cannot count controls: %w", err)
|
||||
}
|
||||
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (s ControlService) ListForDocumentID(
|
||||
ctx context.Context,
|
||||
documentID gid.GID,
|
||||
@@ -83,6 +110,33 @@ func (s ControlService) ListForDocumentID(
|
||||
return page.NewPage(controls, cursor), nil
|
||||
}
|
||||
|
||||
func (s ControlService) CountForMeasureID(
|
||||
ctx context.Context,
|
||||
measureID gid.GID,
|
||||
filter *coredata.ControlFilter,
|
||||
) (int, error) {
|
||||
var count int
|
||||
|
||||
err := s.svc.pg.WithConn(
|
||||
ctx,
|
||||
func(conn pg.Conn) (err error) {
|
||||
controls := &coredata.Controls{}
|
||||
count, err = controls.CountByMeasureID(ctx, conn, s.svc.scope, measureID, filter)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot count controls: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("cannot count controls: %w", err)
|
||||
}
|
||||
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (s ControlService) ListForMeasureID(
|
||||
ctx context.Context,
|
||||
measureID gid.GID,
|
||||
@@ -110,6 +164,182 @@ func (s ControlService) ListForMeasureID(
|
||||
return page.NewPage(controls, cursor), nil
|
||||
}
|
||||
|
||||
func (s ControlService) CountForFrameworkID(
|
||||
ctx context.Context,
|
||||
frameworkID gid.GID,
|
||||
filter *coredata.ControlFilter,
|
||||
) (int, error) {
|
||||
var count int
|
||||
|
||||
err := s.svc.pg.WithConn(
|
||||
ctx,
|
||||
func(conn pg.Conn) (err error) {
|
||||
controls := &coredata.Controls{}
|
||||
count, err = controls.CountByFrameworkID(ctx, conn, s.svc.scope, frameworkID, filter)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot count controls: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("cannot count controls: %w", err)
|
||||
}
|
||||
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (s ControlService) ListForFrameworkID(
|
||||
ctx context.Context,
|
||||
frameworkID gid.GID,
|
||||
cursor *page.Cursor[coredata.ControlOrderField],
|
||||
filter *coredata.ControlFilter,
|
||||
) (*page.Page[*coredata.Control, coredata.ControlOrderField], error) {
|
||||
var controls coredata.Controls
|
||||
framework := &coredata.Framework{}
|
||||
|
||||
err := s.svc.pg.WithConn(
|
||||
ctx,
|
||||
func(conn pg.Conn) error {
|
||||
if err := framework.LoadByID(ctx, conn, s.svc.scope, frameworkID); err != nil {
|
||||
return fmt.Errorf("cannot load framework: %w", err)
|
||||
}
|
||||
|
||||
return controls.LoadByFrameworkID(
|
||||
ctx,
|
||||
conn,
|
||||
s.svc.scope,
|
||||
framework.ID,
|
||||
cursor,
|
||||
filter,
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot list controls: %w", err)
|
||||
}
|
||||
|
||||
return page.NewPage(controls, cursor), nil
|
||||
}
|
||||
|
||||
func (s ControlService) CountForOrganizationID(
|
||||
ctx context.Context,
|
||||
organizationID gid.GID,
|
||||
filter *coredata.ControlFilter,
|
||||
) (int, error) {
|
||||
var count int
|
||||
|
||||
err := s.svc.pg.WithConn(
|
||||
ctx,
|
||||
func(conn pg.Conn) (err error) {
|
||||
controls := &coredata.Controls{}
|
||||
count, err = controls.CountByOrganizationID(ctx, conn, s.svc.scope, organizationID, filter)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot count controls: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("cannot count controls: %w", err)
|
||||
}
|
||||
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (s ControlService) ListForOrganizationID(
|
||||
ctx context.Context,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[coredata.ControlOrderField],
|
||||
filter *coredata.ControlFilter,
|
||||
) (*page.Page[*coredata.Control, coredata.ControlOrderField], error) {
|
||||
var controls coredata.Controls
|
||||
organization := &coredata.Organization{}
|
||||
|
||||
err := s.svc.pg.WithConn(
|
||||
ctx,
|
||||
func(conn pg.Conn) error {
|
||||
if err := organization.LoadByID(ctx, conn, s.svc.scope, organizationID); err != nil {
|
||||
return fmt.Errorf("cannot load organization: %w", err)
|
||||
}
|
||||
|
||||
return controls.LoadByOrganizationID(
|
||||
ctx,
|
||||
conn,
|
||||
s.svc.scope,
|
||||
organization.ID,
|
||||
cursor,
|
||||
filter,
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot list controls: %w", err)
|
||||
}
|
||||
|
||||
return page.NewPage(controls, cursor), nil
|
||||
}
|
||||
|
||||
func (s ControlService) CountForRiskID(
|
||||
ctx context.Context,
|
||||
riskID gid.GID,
|
||||
filter *coredata.ControlFilter,
|
||||
) (int, error) {
|
||||
var count int
|
||||
|
||||
err := s.svc.pg.WithConn(
|
||||
ctx,
|
||||
func(conn pg.Conn) (err error) {
|
||||
controls := &coredata.Controls{}
|
||||
count, err = controls.CountByRiskID(ctx, conn, s.svc.scope, riskID, filter)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot count controls: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("cannot count controls: %w", err)
|
||||
}
|
||||
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (s ControlService) ListForRiskID(
|
||||
ctx context.Context,
|
||||
riskID gid.GID,
|
||||
cursor *page.Cursor[coredata.ControlOrderField],
|
||||
filter *coredata.ControlFilter,
|
||||
) (*page.Page[*coredata.Control, coredata.ControlOrderField], error) {
|
||||
var controls coredata.Controls
|
||||
risk := &coredata.Risk{}
|
||||
|
||||
err := s.svc.pg.WithConn(
|
||||
ctx,
|
||||
func(conn pg.Conn) error {
|
||||
if err := risk.LoadByID(ctx, conn, s.svc.scope, riskID); err != nil {
|
||||
return fmt.Errorf("cannot load risk: %w", err)
|
||||
}
|
||||
|
||||
return controls.LoadByRiskID(ctx, conn, s.svc.scope, risk.ID, cursor, filter)
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot list controls: %w", err)
|
||||
}
|
||||
|
||||
return page.NewPage(controls, cursor), nil
|
||||
}
|
||||
|
||||
func (s ControlService) CreateMeasureMapping(
|
||||
ctx context.Context,
|
||||
controlID gid.GID,
|
||||
@@ -353,98 +583,3 @@ func (s ControlService) Delete(
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func (s ControlService) ListForFrameworkID(
|
||||
ctx context.Context,
|
||||
frameworkID gid.GID,
|
||||
cursor *page.Cursor[coredata.ControlOrderField],
|
||||
filter *coredata.ControlFilter,
|
||||
) (*page.Page[*coredata.Control, coredata.ControlOrderField], error) {
|
||||
var controls coredata.Controls
|
||||
framework := &coredata.Framework{}
|
||||
|
||||
err := s.svc.pg.WithConn(
|
||||
ctx,
|
||||
func(conn pg.Conn) error {
|
||||
if err := framework.LoadByID(ctx, conn, s.svc.scope, frameworkID); err != nil {
|
||||
return fmt.Errorf("cannot load framework: %w", err)
|
||||
}
|
||||
|
||||
return controls.LoadByFrameworkID(
|
||||
ctx,
|
||||
conn,
|
||||
s.svc.scope,
|
||||
framework.ID,
|
||||
cursor,
|
||||
filter,
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot list controls: %w", err)
|
||||
}
|
||||
|
||||
return page.NewPage(controls, cursor), nil
|
||||
}
|
||||
|
||||
func (s ControlService) ListForOrganizationID(
|
||||
ctx context.Context,
|
||||
organizationID gid.GID,
|
||||
cursor *page.Cursor[coredata.ControlOrderField],
|
||||
filter *coredata.ControlFilter,
|
||||
) (*page.Page[*coredata.Control, coredata.ControlOrderField], error) {
|
||||
var controls coredata.Controls
|
||||
organization := &coredata.Organization{}
|
||||
|
||||
err := s.svc.pg.WithConn(
|
||||
ctx,
|
||||
func(conn pg.Conn) error {
|
||||
if err := organization.LoadByID(ctx, conn, s.svc.scope, organizationID); err != nil {
|
||||
return fmt.Errorf("cannot load organization: %w", err)
|
||||
}
|
||||
|
||||
return controls.LoadByOrganizationID(
|
||||
ctx,
|
||||
conn,
|
||||
s.svc.scope,
|
||||
organization.ID,
|
||||
cursor,
|
||||
filter,
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot list controls: %w", err)
|
||||
}
|
||||
|
||||
return page.NewPage(controls, cursor), nil
|
||||
}
|
||||
|
||||
func (s ControlService) ListForRiskID(
|
||||
ctx context.Context,
|
||||
riskID gid.GID,
|
||||
cursor *page.Cursor[coredata.ControlOrderField],
|
||||
filter *coredata.ControlFilter,
|
||||
) (*page.Page[*coredata.Control, coredata.ControlOrderField], error) {
|
||||
var controls coredata.Controls
|
||||
risk := &coredata.Risk{}
|
||||
|
||||
err := s.svc.pg.WithConn(
|
||||
ctx,
|
||||
func(conn pg.Conn) error {
|
||||
if err := risk.LoadByID(ctx, conn, s.svc.scope, riskID); err != nil {
|
||||
return fmt.Errorf("cannot load risk: %w", err)
|
||||
}
|
||||
|
||||
return controls.LoadByRiskID(ctx, conn, s.svc.scope, risk.ID, cursor, filter)
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot list controls: %w", err)
|
||||
}
|
||||
|
||||
return page.NewPage(controls, cursor), nil
|
||||
}
|
||||
|
||||
@@ -249,10 +249,22 @@ enum VendorComplianceReportOrderField
|
||||
)
|
||||
}
|
||||
|
||||
enum OrganizationOrderField @goModel(model: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderField") {
|
||||
NAME @goEnum(value: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderFieldName")
|
||||
CREATED_AT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderFieldCreatedAt")
|
||||
UPDATED_AT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderFieldUpdatedAt")
|
||||
enum OrganizationOrderField
|
||||
@goModel(
|
||||
model: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderField"
|
||||
) {
|
||||
NAME
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderFieldName"
|
||||
)
|
||||
CREATED_AT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderFieldCreatedAt"
|
||||
)
|
||||
UPDATED_AT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderFieldUpdatedAt"
|
||||
)
|
||||
}
|
||||
|
||||
enum ConnectorOrderField
|
||||
@@ -316,72 +328,168 @@ enum DocumentVersionOrderField
|
||||
)
|
||||
}
|
||||
|
||||
enum VendorCategory @goModel(model: "github.com/getprobo/probo/pkg/coredata.VendorCategory") {
|
||||
ANALYTICS @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryAnalytics")
|
||||
CLOUD_MONITORING @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCloudMonitoring")
|
||||
CLOUD_PROVIDER @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCloudProvider")
|
||||
COLLABORATION @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCollaboration")
|
||||
CUSTOMER_SUPPORT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCustomerSupport")
|
||||
DATA_STORAGE_AND_PROCESSING @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryDataStorageAndProcessing")
|
||||
DOCUMENT_MANAGEMENT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryDocumentManagement")
|
||||
EMPLOYEE_MANAGEMENT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryEmployeeManagement")
|
||||
ENGINEERING @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryEngineering")
|
||||
FINANCE @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryFinance")
|
||||
IDENTITY_PROVIDER @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryIdentityProvider")
|
||||
enum VendorCategory
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.VendorCategory") {
|
||||
ANALYTICS
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryAnalytics"
|
||||
)
|
||||
CLOUD_MONITORING
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCloudMonitoring"
|
||||
)
|
||||
CLOUD_PROVIDER
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCloudProvider"
|
||||
)
|
||||
COLLABORATION
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCollaboration"
|
||||
)
|
||||
CUSTOMER_SUPPORT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCustomerSupport"
|
||||
)
|
||||
DATA_STORAGE_AND_PROCESSING
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryDataStorageAndProcessing"
|
||||
)
|
||||
DOCUMENT_MANAGEMENT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryDocumentManagement"
|
||||
)
|
||||
EMPLOYEE_MANAGEMENT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryEmployeeManagement"
|
||||
)
|
||||
ENGINEERING
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryEngineering"
|
||||
)
|
||||
FINANCE
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryFinance"
|
||||
)
|
||||
IDENTITY_PROVIDER
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryIdentityProvider"
|
||||
)
|
||||
IT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryIT")
|
||||
MARKETING @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryMarketing")
|
||||
OFFICE_OPERATIONS @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryOfficeOperations")
|
||||
OTHER @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryOther")
|
||||
PASSWORD_MANAGEMENT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryPasswordManagement")
|
||||
PRODUCT_AND_DESIGN @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryProductAndDesign")
|
||||
PROFESSIONAL_SERVICES @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryProfessionalServices")
|
||||
RECRUITING @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryRecruiting")
|
||||
SALES @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategorySales")
|
||||
SECURITY @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategorySecurity")
|
||||
VERSION_CONTROL @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryVersionControl")
|
||||
MARKETING
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryMarketing"
|
||||
)
|
||||
OFFICE_OPERATIONS
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryOfficeOperations"
|
||||
)
|
||||
OTHER
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryOther")
|
||||
PASSWORD_MANAGEMENT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryPasswordManagement"
|
||||
)
|
||||
PRODUCT_AND_DESIGN
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryProductAndDesign"
|
||||
)
|
||||
PROFESSIONAL_SERVICES
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryProfessionalServices"
|
||||
)
|
||||
RECRUITING
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryRecruiting"
|
||||
)
|
||||
SALES
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategorySales")
|
||||
SECURITY
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategorySecurity"
|
||||
)
|
||||
VERSION_CONTROL
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryVersionControl"
|
||||
)
|
||||
}
|
||||
|
||||
enum DocumentType @goModel(model: "github.com/getprobo/probo/pkg/coredata.DocumentType") {
|
||||
OTHER @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DocumentTypeOther")
|
||||
enum DocumentType
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.DocumentType") {
|
||||
OTHER
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DocumentTypeOther")
|
||||
ISMS @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DocumentTypeISMS")
|
||||
POLICY @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DocumentTypePolicy")
|
||||
POLICY
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DocumentTypePolicy")
|
||||
}
|
||||
|
||||
enum AssetType @goModel(model: "github.com/getprobo/probo/pkg/coredata.AssetType") {
|
||||
PHYSICAL @goEnum(value: "github.com/getprobo/probo/pkg/coredata.AssetTypePhysical")
|
||||
VIRTUAL @goEnum(value: "github.com/getprobo/probo/pkg/coredata.AssetTypeVirtual")
|
||||
enum AssetType
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.AssetType") {
|
||||
PHYSICAL
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.AssetTypePhysical")
|
||||
VIRTUAL
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.AssetTypeVirtual")
|
||||
}
|
||||
|
||||
enum CriticityLevel @goModel(model: "github.com/getprobo/probo/pkg/coredata.CriticityLevel") {
|
||||
enum CriticityLevel
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.CriticityLevel") {
|
||||
LOW @goEnum(value: "github.com/getprobo/probo/pkg/coredata.CriticityLevelLow")
|
||||
MEDIUM @goEnum(value: "github.com/getprobo/probo/pkg/coredata.CriticityLevelMedium")
|
||||
HIGH @goEnum(value: "github.com/getprobo/probo/pkg/coredata.CriticityLevelHigh")
|
||||
MEDIUM
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.CriticityLevelMedium"
|
||||
)
|
||||
HIGH
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.CriticityLevelHigh")
|
||||
}
|
||||
|
||||
enum AssetOrderField @goModel(model: "github.com/getprobo/probo/pkg/coredata.AssetOrderField") {
|
||||
CREATED_AT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.AssetOrderFieldCreatedAt")
|
||||
AMOUNT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.AssetOrderFieldAmount")
|
||||
CRITICITY @goEnum(value: "github.com/getprobo/probo/pkg/coredata.AssetOrderFieldCriticity")
|
||||
enum AssetOrderField
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.AssetOrderField") {
|
||||
CREATED_AT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.AssetOrderFieldCreatedAt"
|
||||
)
|
||||
AMOUNT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.AssetOrderFieldAmount"
|
||||
)
|
||||
CRITICITY
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.AssetOrderFieldCriticity"
|
||||
)
|
||||
}
|
||||
|
||||
enum DatumOrderField @goModel(model: "github.com/getprobo/probo/pkg/coredata.DatumOrderField") {
|
||||
CREATED_AT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldCreatedAt")
|
||||
NAME @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldName")
|
||||
DATA_CLASSIFICATION @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldDataClassification")
|
||||
enum DatumOrderField
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.DatumOrderField") {
|
||||
CREATED_AT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldCreatedAt"
|
||||
)
|
||||
NAME
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldName")
|
||||
DATA_CLASSIFICATION
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldDataClassification"
|
||||
)
|
||||
}
|
||||
|
||||
enum DataClassification
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.DataClassification") {
|
||||
PUBLIC
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DataClassificationPublic")
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.DataClassificationPublic"
|
||||
)
|
||||
INTERNAL
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DataClassificationInternal")
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.DataClassificationInternal"
|
||||
)
|
||||
CONFIDENTIAL
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DataClassificationConfidential")
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.DataClassificationConfidential"
|
||||
)
|
||||
SECRET
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DataClassificationSecret")
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.DataClassificationSecret"
|
||||
)
|
||||
}
|
||||
|
||||
# Input Types
|
||||
input UserOrder
|
||||
@goModel(
|
||||
@@ -992,7 +1100,11 @@ type FrameworkEdge {
|
||||
node: Framework!
|
||||
}
|
||||
|
||||
type ControlConnection {
|
||||
type ControlConnection
|
||||
@goModel(
|
||||
model: "github.com/getprobo/probo/pkg/server/api/console/v1/types.ControlConnection"
|
||||
) {
|
||||
totalCount: Int! @goField(forceResolver: true)
|
||||
edges: [ControlEdge!]!
|
||||
pageInfo: PageInfo!
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ type Config struct {
|
||||
type ResolverRoot interface {
|
||||
Asset() AssetResolver
|
||||
Control() ControlResolver
|
||||
ControlConnection() ControlConnectionResolver
|
||||
Datum() DatumResolver
|
||||
Document() DocumentResolver
|
||||
DocumentVersion() DocumentVersionResolver
|
||||
@@ -134,8 +135,9 @@ type ComplexityRoot struct {
|
||||
}
|
||||
|
||||
ControlConnection struct {
|
||||
Edges func(childComplexity int) int
|
||||
PageInfo func(childComplexity int) int
|
||||
Edges func(childComplexity int) int
|
||||
PageInfo func(childComplexity int) int
|
||||
TotalCount func(childComplexity int) int
|
||||
}
|
||||
|
||||
ControlEdge struct {
|
||||
@@ -874,6 +876,9 @@ type ControlResolver interface {
|
||||
Measures(ctx context.Context, obj *types.Control, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.MeasureOrderBy, filter *types.MeasureFilter) (*types.MeasureConnection, error)
|
||||
Documents(ctx context.Context, obj *types.Control, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentOrderBy, filter *types.DocumentFilter) (*types.DocumentConnection, error)
|
||||
}
|
||||
type ControlConnectionResolver interface {
|
||||
TotalCount(ctx context.Context, obj *types.ControlConnection) (int, error)
|
||||
}
|
||||
type DatumResolver interface {
|
||||
Owner(ctx context.Context, obj *types.Datum) (*types.People, error)
|
||||
Vendors(ctx context.Context, obj *types.Datum, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.VendorOrderBy) (*types.VendorConnection, error)
|
||||
@@ -1336,6 +1341,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
||||
|
||||
return e.complexity.ControlConnection.PageInfo(childComplexity), true
|
||||
|
||||
case "ControlConnection.totalCount":
|
||||
if e.complexity.ControlConnection.TotalCount == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.ControlConnection.TotalCount(childComplexity), true
|
||||
|
||||
case "ControlEdge.cursor":
|
||||
if e.complexity.ControlEdge.Cursor == nil {
|
||||
break
|
||||
@@ -4946,10 +4958,22 @@ enum VendorComplianceReportOrderField
|
||||
)
|
||||
}
|
||||
|
||||
enum OrganizationOrderField @goModel(model: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderField") {
|
||||
NAME @goEnum(value: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderFieldName")
|
||||
CREATED_AT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderFieldCreatedAt")
|
||||
UPDATED_AT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderFieldUpdatedAt")
|
||||
enum OrganizationOrderField
|
||||
@goModel(
|
||||
model: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderField"
|
||||
) {
|
||||
NAME
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderFieldName"
|
||||
)
|
||||
CREATED_AT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderFieldCreatedAt"
|
||||
)
|
||||
UPDATED_AT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderFieldUpdatedAt"
|
||||
)
|
||||
}
|
||||
|
||||
enum ConnectorOrderField
|
||||
@@ -5013,72 +5037,168 @@ enum DocumentVersionOrderField
|
||||
)
|
||||
}
|
||||
|
||||
enum VendorCategory @goModel(model: "github.com/getprobo/probo/pkg/coredata.VendorCategory") {
|
||||
ANALYTICS @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryAnalytics")
|
||||
CLOUD_MONITORING @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCloudMonitoring")
|
||||
CLOUD_PROVIDER @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCloudProvider")
|
||||
COLLABORATION @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCollaboration")
|
||||
CUSTOMER_SUPPORT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCustomerSupport")
|
||||
DATA_STORAGE_AND_PROCESSING @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryDataStorageAndProcessing")
|
||||
DOCUMENT_MANAGEMENT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryDocumentManagement")
|
||||
EMPLOYEE_MANAGEMENT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryEmployeeManagement")
|
||||
ENGINEERING @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryEngineering")
|
||||
FINANCE @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryFinance")
|
||||
IDENTITY_PROVIDER @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryIdentityProvider")
|
||||
enum VendorCategory
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.VendorCategory") {
|
||||
ANALYTICS
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryAnalytics"
|
||||
)
|
||||
CLOUD_MONITORING
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCloudMonitoring"
|
||||
)
|
||||
CLOUD_PROVIDER
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCloudProvider"
|
||||
)
|
||||
COLLABORATION
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCollaboration"
|
||||
)
|
||||
CUSTOMER_SUPPORT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryCustomerSupport"
|
||||
)
|
||||
DATA_STORAGE_AND_PROCESSING
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryDataStorageAndProcessing"
|
||||
)
|
||||
DOCUMENT_MANAGEMENT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryDocumentManagement"
|
||||
)
|
||||
EMPLOYEE_MANAGEMENT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryEmployeeManagement"
|
||||
)
|
||||
ENGINEERING
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryEngineering"
|
||||
)
|
||||
FINANCE
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryFinance"
|
||||
)
|
||||
IDENTITY_PROVIDER
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryIdentityProvider"
|
||||
)
|
||||
IT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryIT")
|
||||
MARKETING @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryMarketing")
|
||||
OFFICE_OPERATIONS @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryOfficeOperations")
|
||||
OTHER @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryOther")
|
||||
PASSWORD_MANAGEMENT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryPasswordManagement")
|
||||
PRODUCT_AND_DESIGN @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryProductAndDesign")
|
||||
PROFESSIONAL_SERVICES @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryProfessionalServices")
|
||||
RECRUITING @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryRecruiting")
|
||||
SALES @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategorySales")
|
||||
SECURITY @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategorySecurity")
|
||||
VERSION_CONTROL @goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryVersionControl")
|
||||
MARKETING
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryMarketing"
|
||||
)
|
||||
OFFICE_OPERATIONS
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryOfficeOperations"
|
||||
)
|
||||
OTHER
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryOther")
|
||||
PASSWORD_MANAGEMENT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryPasswordManagement"
|
||||
)
|
||||
PRODUCT_AND_DESIGN
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryProductAndDesign"
|
||||
)
|
||||
PROFESSIONAL_SERVICES
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryProfessionalServices"
|
||||
)
|
||||
RECRUITING
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryRecruiting"
|
||||
)
|
||||
SALES
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.VendorCategorySales")
|
||||
SECURITY
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategorySecurity"
|
||||
)
|
||||
VERSION_CONTROL
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.VendorCategoryVersionControl"
|
||||
)
|
||||
}
|
||||
|
||||
enum DocumentType @goModel(model: "github.com/getprobo/probo/pkg/coredata.DocumentType") {
|
||||
OTHER @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DocumentTypeOther")
|
||||
enum DocumentType
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.DocumentType") {
|
||||
OTHER
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DocumentTypeOther")
|
||||
ISMS @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DocumentTypeISMS")
|
||||
POLICY @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DocumentTypePolicy")
|
||||
POLICY
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DocumentTypePolicy")
|
||||
}
|
||||
|
||||
enum AssetType @goModel(model: "github.com/getprobo/probo/pkg/coredata.AssetType") {
|
||||
PHYSICAL @goEnum(value: "github.com/getprobo/probo/pkg/coredata.AssetTypePhysical")
|
||||
VIRTUAL @goEnum(value: "github.com/getprobo/probo/pkg/coredata.AssetTypeVirtual")
|
||||
enum AssetType
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.AssetType") {
|
||||
PHYSICAL
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.AssetTypePhysical")
|
||||
VIRTUAL
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.AssetTypeVirtual")
|
||||
}
|
||||
|
||||
enum CriticityLevel @goModel(model: "github.com/getprobo/probo/pkg/coredata.CriticityLevel") {
|
||||
enum CriticityLevel
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.CriticityLevel") {
|
||||
LOW @goEnum(value: "github.com/getprobo/probo/pkg/coredata.CriticityLevelLow")
|
||||
MEDIUM @goEnum(value: "github.com/getprobo/probo/pkg/coredata.CriticityLevelMedium")
|
||||
HIGH @goEnum(value: "github.com/getprobo/probo/pkg/coredata.CriticityLevelHigh")
|
||||
MEDIUM
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.CriticityLevelMedium"
|
||||
)
|
||||
HIGH
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.CriticityLevelHigh")
|
||||
}
|
||||
|
||||
enum AssetOrderField @goModel(model: "github.com/getprobo/probo/pkg/coredata.AssetOrderField") {
|
||||
CREATED_AT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.AssetOrderFieldCreatedAt")
|
||||
AMOUNT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.AssetOrderFieldAmount")
|
||||
CRITICITY @goEnum(value: "github.com/getprobo/probo/pkg/coredata.AssetOrderFieldCriticity")
|
||||
enum AssetOrderField
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.AssetOrderField") {
|
||||
CREATED_AT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.AssetOrderFieldCreatedAt"
|
||||
)
|
||||
AMOUNT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.AssetOrderFieldAmount"
|
||||
)
|
||||
CRITICITY
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.AssetOrderFieldCriticity"
|
||||
)
|
||||
}
|
||||
|
||||
enum DatumOrderField @goModel(model: "github.com/getprobo/probo/pkg/coredata.DatumOrderField") {
|
||||
CREATED_AT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldCreatedAt")
|
||||
NAME @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldName")
|
||||
DATA_CLASSIFICATION @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldDataClassification")
|
||||
enum DatumOrderField
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.DatumOrderField") {
|
||||
CREATED_AT
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldCreatedAt"
|
||||
)
|
||||
NAME
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldName")
|
||||
DATA_CLASSIFICATION
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldDataClassification"
|
||||
)
|
||||
}
|
||||
|
||||
enum DataClassification
|
||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.DataClassification") {
|
||||
PUBLIC
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DataClassificationPublic")
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.DataClassificationPublic"
|
||||
)
|
||||
INTERNAL
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DataClassificationInternal")
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.DataClassificationInternal"
|
||||
)
|
||||
CONFIDENTIAL
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DataClassificationConfidential")
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.DataClassificationConfidential"
|
||||
)
|
||||
SECRET
|
||||
@goEnum(value: "github.com/getprobo/probo/pkg/coredata.DataClassificationSecret")
|
||||
@goEnum(
|
||||
value: "github.com/getprobo/probo/pkg/coredata.DataClassificationSecret"
|
||||
)
|
||||
}
|
||||
|
||||
# Input Types
|
||||
input UserOrder
|
||||
@goModel(
|
||||
@@ -5689,7 +5809,11 @@ type FrameworkEdge {
|
||||
node: Framework!
|
||||
}
|
||||
|
||||
type ControlConnection {
|
||||
type ControlConnection
|
||||
@goModel(
|
||||
model: "github.com/getprobo/probo/pkg/server/api/console/v1/types.ControlConnection"
|
||||
) {
|
||||
totalCount: Int! @goField(forceResolver: true)
|
||||
edges: [ControlEdge!]!
|
||||
pageInfo: PageInfo!
|
||||
}
|
||||
@@ -13484,6 +13608,50 @@ func (ec *executionContext) fieldContext_Control_updatedAt(_ context.Context, fi
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _ControlConnection_totalCount(ctx context.Context, field graphql.CollectedField, obj *types.ControlConnection) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_ControlConnection_totalCount(ctx, field)
|
||||
if err != nil {
|
||||
return graphql.Null
|
||||
}
|
||||
ctx = graphql.WithFieldContext(ctx, fc)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
ret = graphql.Null
|
||||
}
|
||||
}()
|
||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
||||
ctx = rctx // use context from middleware stack in children
|
||||
return ec.resolvers.ControlConnection().TotalCount(rctx, obj)
|
||||
})
|
||||
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.(int)
|
||||
fc.Result = res
|
||||
return ec.marshalNInt2int(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) fieldContext_ControlConnection_totalCount(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
fc = &graphql.FieldContext{
|
||||
Object: "ControlConnection",
|
||||
Field: field,
|
||||
IsMethod: true,
|
||||
IsResolver: true,
|
||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||
return nil, errors.New("field of type Int does not have child fields")
|
||||
},
|
||||
}
|
||||
return fc, nil
|
||||
}
|
||||
|
||||
func (ec *executionContext) _ControlConnection_edges(ctx context.Context, field graphql.CollectedField, obj *types.ControlConnection) (ret graphql.Marshaler) {
|
||||
fc, err := ec.fieldContext_ControlConnection_edges(ctx, field)
|
||||
if err != nil {
|
||||
@@ -13560,9 +13728,9 @@ func (ec *executionContext) _ControlConnection_pageInfo(ctx context.Context, fie
|
||||
}
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(*types.PageInfo)
|
||||
res := resTmp.(types.PageInfo)
|
||||
fc.Result = res
|
||||
return ec.marshalNPageInfo2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPageInfo(ctx, field.Selections, res)
|
||||
return ec.marshalNPageInfo2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPageInfo(ctx, field.Selections, res)
|
||||
}
|
||||
|
||||
func (ec *executionContext) fieldContext_ControlConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||
@@ -16826,6 +16994,8 @@ func (ec *executionContext) fieldContext_Document_controls(ctx context.Context,
|
||||
IsResolver: true,
|
||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||
switch field.Name {
|
||||
case "totalCount":
|
||||
return ec.fieldContext_ControlConnection_totalCount(ctx, field)
|
||||
case "edges":
|
||||
return ec.fieldContext_ControlConnection_edges(ctx, field)
|
||||
case "pageInfo":
|
||||
@@ -19828,6 +19998,8 @@ func (ec *executionContext) fieldContext_Framework_controls(ctx context.Context,
|
||||
IsResolver: true,
|
||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||
switch field.Name {
|
||||
case "totalCount":
|
||||
return ec.fieldContext_ControlConnection_totalCount(ctx, field)
|
||||
case "edges":
|
||||
return ec.fieldContext_ControlConnection_edges(ctx, field)
|
||||
case "pageInfo":
|
||||
@@ -20826,6 +20998,8 @@ func (ec *executionContext) fieldContext_Measure_controls(ctx context.Context, f
|
||||
IsResolver: true,
|
||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||
switch field.Name {
|
||||
case "totalCount":
|
||||
return ec.fieldContext_ControlConnection_totalCount(ctx, field)
|
||||
case "edges":
|
||||
return ec.fieldContext_ControlConnection_edges(ctx, field)
|
||||
case "pageInfo":
|
||||
@@ -25240,6 +25414,8 @@ func (ec *executionContext) fieldContext_Organization_controls(ctx context.Conte
|
||||
IsResolver: true,
|
||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||
switch field.Name {
|
||||
case "totalCount":
|
||||
return ec.fieldContext_ControlConnection_totalCount(ctx, field)
|
||||
case "edges":
|
||||
return ec.fieldContext_ControlConnection_edges(ctx, field)
|
||||
case "pageInfo":
|
||||
@@ -28235,6 +28411,8 @@ func (ec *executionContext) fieldContext_Risk_controls(ctx context.Context, fiel
|
||||
IsResolver: true,
|
||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||
switch field.Name {
|
||||
case "totalCount":
|
||||
return ec.fieldContext_ControlConnection_totalCount(ctx, field)
|
||||
case "edges":
|
||||
return ec.fieldContext_ControlConnection_edges(ctx, field)
|
||||
case "pageInfo":
|
||||
@@ -40544,15 +40722,51 @@ func (ec *executionContext) _ControlConnection(ctx context.Context, sel ast.Sele
|
||||
switch field.Name {
|
||||
case "__typename":
|
||||
out.Values[i] = graphql.MarshalString("ControlConnection")
|
||||
case "totalCount":
|
||||
field := field
|
||||
|
||||
innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
ec.Error(ctx, ec.Recover(ctx, r))
|
||||
}
|
||||
}()
|
||||
res = ec._ControlConnection_totalCount(ctx, field, obj)
|
||||
if res == graphql.Null {
|
||||
atomic.AddUint32(&fs.Invalids, 1)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
if field.Deferrable != nil {
|
||||
dfs, ok := deferred[field.Deferrable.Label]
|
||||
di := 0
|
||||
if ok {
|
||||
dfs.AddField(field)
|
||||
di = len(dfs.Values) - 1
|
||||
} else {
|
||||
dfs = graphql.NewFieldSet([]graphql.CollectedField{field})
|
||||
deferred[field.Deferrable.Label] = dfs
|
||||
}
|
||||
dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler {
|
||||
return innerFunc(ctx, dfs)
|
||||
})
|
||||
|
||||
// don't run the out.Concurrently() call below
|
||||
out.Values[i] = graphql.Null
|
||||
continue
|
||||
}
|
||||
|
||||
out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
|
||||
case "edges":
|
||||
out.Values[i] = ec._ControlConnection_edges(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
out.Invalids++
|
||||
atomic.AddUint32(&out.Invalids, 1)
|
||||
}
|
||||
case "pageInfo":
|
||||
out.Values[i] = ec._ControlConnection_pageInfo(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
out.Invalids++
|
||||
atomic.AddUint32(&out.Invalids, 1)
|
||||
}
|
||||
default:
|
||||
panic("unknown field " + strconv.Quote(field.Name))
|
||||
@@ -50885,6 +51099,10 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
func (ec *executionContext) marshalNPageInfo2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v types.PageInfo) graphql.Marshaler {
|
||||
return ec._PageInfo(ctx, sel, &v)
|
||||
}
|
||||
|
||||
func (ec *executionContext) marshalNPageInfo2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v *types.PageInfo) graphql.Marshaler {
|
||||
if v == nil {
|
||||
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
||||
|
||||
@@ -16,6 +16,7 @@ package types
|
||||
|
||||
import (
|
||||
"github.com/getprobo/probo/pkg/coredata"
|
||||
"github.com/getprobo/probo/pkg/gid"
|
||||
"github.com/getprobo/probo/pkg/page"
|
||||
)
|
||||
|
||||
@@ -23,7 +24,12 @@ type (
|
||||
ControlOrderBy OrderBy[coredata.ControlOrderField]
|
||||
)
|
||||
|
||||
func NewControlConnection(p *page.Page[*coredata.Control, coredata.ControlOrderField]) *ControlConnection {
|
||||
func NewControlConnection(
|
||||
p *page.Page[*coredata.Control, coredata.ControlOrderField],
|
||||
parentType any,
|
||||
parentID gid.GID,
|
||||
filters *coredata.ControlFilter,
|
||||
) *ControlConnection {
|
||||
var edges = make([]*ControlEdge, len(p.Data))
|
||||
|
||||
for i := range edges {
|
||||
@@ -32,7 +38,11 @@ func NewControlConnection(p *page.Page[*coredata.Control, coredata.ControlOrderF
|
||||
|
||||
return &ControlConnection{
|
||||
Edges: edges,
|
||||
PageInfo: NewPageInfo(p),
|
||||
PageInfo: *NewPageInfo(p),
|
||||
|
||||
Resolver: parentType,
|
||||
ParentID: parentID,
|
||||
Filters: filters,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
18
pkg/server/api/console/v1/types/control_connection.go
Normal file
18
pkg/server/api/console/v1/types/control_connection.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"github.com/getprobo/probo/pkg/coredata"
|
||||
"github.com/getprobo/probo/pkg/gid"
|
||||
)
|
||||
|
||||
type (
|
||||
ControlConnection struct {
|
||||
TotalCount int
|
||||
Edges []*ControlEdge
|
||||
PageInfo PageInfo
|
||||
|
||||
Resolver any
|
||||
ParentID gid.GID
|
||||
Filters *coredata.ControlFilter
|
||||
}
|
||||
)
|
||||
@@ -115,11 +115,6 @@ type Control struct {
|
||||
func (Control) IsNode() {}
|
||||
func (this Control) GetID() gid.GID { return this.ID }
|
||||
|
||||
type ControlConnection struct {
|
||||
Edges []*ControlEdge `json:"edges"`
|
||||
PageInfo *PageInfo `json:"pageInfo"`
|
||||
}
|
||||
|
||||
type ControlEdge struct {
|
||||
Cursor page.CursorKey `json:"cursor"`
|
||||
Node *Control `json:"node"`
|
||||
|
||||
@@ -167,6 +167,46 @@ func (r *controlResolver) Documents(ctx context.Context, obj *types.Control, fir
|
||||
return types.NewDocumentConnection(page), nil
|
||||
}
|
||||
|
||||
// TotalCount is the resolver for the totalCount field.
|
||||
func (r *controlConnectionResolver) TotalCount(ctx context.Context, obj *types.ControlConnection) (int, error) {
|
||||
svc := GetTenantService(ctx, r.proboSvc, obj.ParentID.TenantID())
|
||||
|
||||
switch obj.Resolver.(type) {
|
||||
case *organizationResolver:
|
||||
count, err := svc.Controls.CountForOrganizationID(ctx, obj.ParentID, obj.Filters)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("cannot count controls: %w", err)
|
||||
}
|
||||
return count, nil
|
||||
case *frameworkResolver:
|
||||
count, err := svc.Controls.CountForFrameworkID(ctx, obj.ParentID, obj.Filters)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("cannot count controls: %w", err)
|
||||
}
|
||||
return count, nil
|
||||
case *documentResolver:
|
||||
count, err := svc.Controls.CountForDocumentID(ctx, obj.ParentID, obj.Filters)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("cannot count controls: %w", err)
|
||||
}
|
||||
return count, nil
|
||||
case *measureResolver:
|
||||
count, err := svc.Controls.CountForMeasureID(ctx, obj.ParentID, obj.Filters)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("cannot count controls: %w", err)
|
||||
}
|
||||
return count, nil
|
||||
case *riskResolver:
|
||||
count, err := svc.Controls.CountForRiskID(ctx, obj.ParentID, obj.Filters)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("cannot count controls: %w", err)
|
||||
}
|
||||
return count, nil
|
||||
default:
|
||||
panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver))
|
||||
}
|
||||
}
|
||||
|
||||
// Owner is the resolver for the owner field.
|
||||
func (r *datumResolver) Owner(ctx context.Context, obj *types.Datum) (*types.People, error) {
|
||||
svc := GetTenantService(ctx, r.proboSvc, obj.ID.TenantID())
|
||||
@@ -308,7 +348,7 @@ func (r *documentResolver) Controls(ctx context.Context, obj *types.Document, fi
|
||||
panic(fmt.Errorf("cannot list document controls: %w", err))
|
||||
}
|
||||
|
||||
return types.NewControlConnection(page), nil
|
||||
return types.NewControlConnection(page, r, obj.ID, controlFilter), nil
|
||||
}
|
||||
|
||||
// Document is the resolver for the document field.
|
||||
@@ -541,7 +581,7 @@ func (r *frameworkResolver) Controls(ctx context.Context, obj *types.Framework,
|
||||
return nil, fmt.Errorf("cannot list controls: %w", err)
|
||||
}
|
||||
|
||||
return types.NewControlConnection(page), nil
|
||||
return types.NewControlConnection(page, r, obj.ID, controlFilter), nil
|
||||
}
|
||||
|
||||
// Evidences is the resolver for the evidences field.
|
||||
@@ -651,7 +691,7 @@ func (r *measureResolver) Controls(ctx context.Context, obj *types.Measure, firs
|
||||
return nil, fmt.Errorf("cannot list measure controls: %w", err)
|
||||
}
|
||||
|
||||
return types.NewControlConnection(page), nil
|
||||
return types.NewControlConnection(page, r, obj.ID, controlFilter), nil
|
||||
}
|
||||
|
||||
// CreateOrganization is the resolver for the createOrganization field.
|
||||
@@ -2016,7 +2056,7 @@ func (r *organizationResolver) Controls(ctx context.Context, obj *types.Organiza
|
||||
return nil, fmt.Errorf("cannot list controls: %w", err)
|
||||
}
|
||||
|
||||
return types.NewControlConnection(page), nil
|
||||
return types.NewControlConnection(page, r, obj.ID, controlFilter), nil
|
||||
}
|
||||
|
||||
// Vendors is the resolver for the vendors field.
|
||||
@@ -2479,7 +2519,7 @@ func (r *riskResolver) Controls(ctx context.Context, obj *types.Risk, first *int
|
||||
panic(fmt.Errorf("cannot list risk controls: %w", err))
|
||||
}
|
||||
|
||||
return types.NewControlConnection(page), nil
|
||||
return types.NewControlConnection(page, r, obj.ID, controlFilter), nil
|
||||
}
|
||||
|
||||
// AssignedTo is the resolver for the assignedTo field.
|
||||
@@ -2765,6 +2805,11 @@ func (r *Resolver) Asset() schema.AssetResolver { return &assetResolver{r} }
|
||||
// Control returns schema.ControlResolver implementation.
|
||||
func (r *Resolver) Control() schema.ControlResolver { return &controlResolver{r} }
|
||||
|
||||
// ControlConnection returns schema.ControlConnectionResolver implementation.
|
||||
func (r *Resolver) ControlConnection() schema.ControlConnectionResolver {
|
||||
return &controlConnectionResolver{r}
|
||||
}
|
||||
|
||||
// Datum returns schema.DatumResolver implementation.
|
||||
func (r *Resolver) Datum() schema.DatumResolver { return &datumResolver{r} }
|
||||
|
||||
@@ -2826,6 +2871,7 @@ func (r *Resolver) Viewer() schema.ViewerResolver { return &viewerResolver{r} }
|
||||
|
||||
type assetResolver struct{ *Resolver }
|
||||
type controlResolver struct{ *Resolver }
|
||||
type controlConnectionResolver struct{ *Resolver }
|
||||
type datumResolver struct{ *Resolver }
|
||||
type documentResolver struct{ *Resolver }
|
||||
type documentVersionResolver struct{ *Resolver }
|
||||
|
||||
Reference in New Issue
Block a user