Replace the old snapshot-based system for vendors with the publish document system, mirroring the prior processing activity / DPIA / TIA migration. Includes the GraphQL mutation, MCP tool, CLI command, n8n operation, frontend publish dialog, e2e tests, and a prosemirror register template covering vendor profile fields plus per-vendor sections for services, contacts, risk assessments, compliance reports, BAA and DPA agreements. The vendor register lives as a generated DocumentTypeRegister document on the organization, reused across publishes (the major version bumps on every republish). Approvers can be passed in to create a draft pending approval; otherwise the version is published immediately. The frontend Vendors page exposes a Publish button and a Document link button when the document exists, and pre-fills the previous default approvers. Remove snapshot mode entirely from vendors and their sub-entities: drop snapshotId/sourceId from GraphQL Vendor type and VendorFilter; remove SnapshotsTypeVendors from the snapshot registry and delete Vendors.Snapshot, VendorSnapshotter interface and all *.InsertVendorSnapshots methods on contacts, services, risk assessments, compliance reports, BAA and DPA. Drop the snapshot routes and banner from the frontend. The snapshot_id columns remain in the database but are now filtered out with snapshot_id IS NULL. Add Get/Upsert/Clear GeneratedDocumentID methods on Vendor backed by a new vendors_document_id column on generated_documents, matching the ProcessingActivity/Finding/Obligation pattern. Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
70 lines
2.0 KiB
Go
70 lines
2.0 KiB
Go
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.com>.
|
|
//
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
// copyright notice and this permission notice appear in all copies.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
// PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
package mcp_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
"go.probo.inc/probo/e2e/internal/factory"
|
|
"go.probo.inc/probo/e2e/internal/testutil"
|
|
)
|
|
|
|
func TestMCP_Snapshot(t *testing.T) {
|
|
t.Parallel()
|
|
owner := testutil.NewClient(t, testutil.RoleOwner)
|
|
mc := testutil.NewMCPClient(t, owner)
|
|
orgID := owner.GetOrganizationID().String()
|
|
|
|
// Create a risk so the snapshot has data
|
|
factory.CreateRisk(owner)
|
|
|
|
// Take snapshot
|
|
var takeResult struct {
|
|
Snapshot struct {
|
|
ID string `json:"id"`
|
|
} `json:"snapshot"`
|
|
}
|
|
mc.CallToolInto("takeSnapshot", map[string]any{
|
|
"organizationId": orgID,
|
|
"name": factory.SafeName("Snapshot"),
|
|
"snapshotsType": "RISKS",
|
|
}, &takeResult)
|
|
require.NotEmpty(t, takeResult.Snapshot.ID)
|
|
|
|
// Get
|
|
var getResult struct {
|
|
Snapshot struct {
|
|
ID string `json:"id"`
|
|
} `json:"snapshot"`
|
|
}
|
|
mc.CallToolInto("getSnapshot", map[string]any{
|
|
"id": takeResult.Snapshot.ID,
|
|
}, &getResult)
|
|
assert.Equal(t, takeResult.Snapshot.ID, getResult.Snapshot.ID)
|
|
|
|
// List
|
|
var listResult struct {
|
|
Snapshots []struct {
|
|
ID string `json:"id"`
|
|
} `json:"snapshots"`
|
|
}
|
|
mc.CallToolInto("listSnapshots", map[string]any{
|
|
"organizationId": orgID,
|
|
}, &listResult)
|
|
assert.NotEmpty(t, listResult.Snapshots)
|
|
}
|