Fix MCP snapshot issues for SOA and vendors
- Fix SnapshotsType enum: STATES_OF_APPLICABILITY → STATEMENTS_OF_APPLICABILITY - Add snapshot filter to ListStatementsOfApplicability MCP tool - Add missing organization_id to vendor contacts and compliance reports snapshot inserts Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -269,6 +269,7 @@ WITH
|
|||||||
INSERT INTO vendor_compliance_reports (
|
INSERT INTO vendor_compliance_reports (
|
||||||
tenant_id,
|
tenant_id,
|
||||||
id,
|
id,
|
||||||
|
organization_id,
|
||||||
snapshot_id,
|
snapshot_id,
|
||||||
source_id,
|
source_id,
|
||||||
vendor_id,
|
vendor_id,
|
||||||
@@ -282,6 +283,7 @@ INSERT INTO vendor_compliance_reports (
|
|||||||
SELECT
|
SELECT
|
||||||
@tenant_id,
|
@tenant_id,
|
||||||
generate_gid(decode_base64_unpadded(@tenant_id), @vendor_compliance_report_entity_type),
|
generate_gid(decode_base64_unpadded(@tenant_id), @vendor_compliance_report_entity_type),
|
||||||
|
@organization_id,
|
||||||
@snapshot_id,
|
@snapshot_id,
|
||||||
vcr.id,
|
vcr.id,
|
||||||
sv.id,
|
sv.id,
|
||||||
|
|||||||
@@ -314,6 +314,7 @@ WITH
|
|||||||
INSERT INTO vendor_contacts (
|
INSERT INTO vendor_contacts (
|
||||||
tenant_id,
|
tenant_id,
|
||||||
id,
|
id,
|
||||||
|
organization_id,
|
||||||
snapshot_id,
|
snapshot_id,
|
||||||
source_id,
|
source_id,
|
||||||
vendor_id,
|
vendor_id,
|
||||||
@@ -327,6 +328,7 @@ INSERT INTO vendor_contacts (
|
|||||||
SELECT
|
SELECT
|
||||||
@tenant_id,
|
@tenant_id,
|
||||||
generate_gid(decode_base64_unpadded(@tenant_id), @vendor_contact_entity_type),
|
generate_gid(decode_base64_unpadded(@tenant_id), @vendor_contact_entity_type),
|
||||||
|
@organization_id,
|
||||||
@snapshot_id,
|
@snapshot_id,
|
||||||
vc.id,
|
vc.id,
|
||||||
sv.id,
|
sv.id,
|
||||||
|
|||||||
@@ -2869,7 +2869,13 @@ func (r *Resolver) ListStatementsOfApplicabilityTool(ctx context.Context, req *m
|
|||||||
|
|
||||||
cursor := types.NewCursor(input.Size, input.Cursor, pageOrderBy)
|
cursor := types.NewCursor(input.Size, input.Cursor, pageOrderBy)
|
||||||
|
|
||||||
pg, err := prb.StatementsOfApplicability.ListForOrganizationID(ctx, input.OrganizationID, cursor, coredata.NewStatementOfApplicabilityFilter(nil))
|
noSnapshot := (*gid.GID)(nil)
|
||||||
|
filter := coredata.NewStatementOfApplicabilityFilter(&noSnapshot)
|
||||||
|
if input.Filter != nil {
|
||||||
|
filter = coredata.NewStatementOfApplicabilityFilter(&input.Filter.SnapshotID)
|
||||||
|
}
|
||||||
|
|
||||||
|
pg, err := prb.StatementsOfApplicability.ListForOrganizationID(ctx, input.OrganizationID, cursor, filter)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, types.ListStatementsOfApplicabilityOutput{}, fmt.Errorf("failed to list statements of applicability: %w", err)
|
return nil, types.ListStatementsOfApplicabilityOutput{}, fmt.Errorf("failed to list statements of applicability: %w", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4996,7 +4996,7 @@ components:
|
|||||||
- OBLIGATIONS
|
- OBLIGATIONS
|
||||||
- CONTINUAL_IMPROVEMENTS
|
- CONTINUAL_IMPROVEMENTS
|
||||||
- PROCESSING_ACTIVITIES
|
- PROCESSING_ACTIVITIES
|
||||||
- STATES_OF_APPLICABILITY
|
- STATEMENTS_OF_APPLICABILITY
|
||||||
go.probo.inc/mcpgen/type: go.probo.inc/probo/pkg/coredata.SnapshotsType
|
go.probo.inc/mcpgen/type: go.probo.inc/probo/pkg/coredata.SnapshotsType
|
||||||
|
|
||||||
SnapshotOrderField:
|
SnapshotOrderField:
|
||||||
@@ -6173,6 +6173,15 @@ components:
|
|||||||
cursor:
|
cursor:
|
||||||
$ref: "#/components/schemas/CursorKey"
|
$ref: "#/components/schemas/CursorKey"
|
||||||
description: Page cursor
|
description: Page cursor
|
||||||
|
filter:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
snapshot_id:
|
||||||
|
anyOf:
|
||||||
|
- $ref: "#/components/schemas/GID"
|
||||||
|
- type: "null"
|
||||||
|
description: Filter by snapshot ID. Defaults to null, which returns only statements of applicability with no snapshot (current live data). Pass a specific snapshot ID to retrieve statements of applicability as they were at that snapshot.
|
||||||
|
default: null
|
||||||
|
|
||||||
ListStatementsOfApplicabilityOutput:
|
ListStatementsOfApplicabilityOutput:
|
||||||
type: object
|
type: object
|
||||||
|
|||||||
Reference in New Issue
Block a user