Rename owner by approver

Document owner does not make sense it's more an document approver.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-02-13 10:12:48 +01:00
committed by Sacha Al Himdani
parent 891d607602
commit 3d8c7c4dd6
32 changed files with 301 additions and 296 deletions

View File

@@ -32,7 +32,7 @@ type (
Document struct {
ID gid.GID `db:"id"`
OrganizationID gid.GID `db:"organization_id"`
OwnerID gid.GID `db:"owner_profile_id"`
ApproverID gid.GID `db:"approver_profile_id"`
Title string `db:"title"`
DocumentType DocumentType `db:"document_type"`
Classification DocumentClassification `db:"classification"`
@@ -83,7 +83,7 @@ func (p *Document) LoadByID(
SELECT
id,
organization_id,
owner_profile_id,
approver_profile_id,
title,
document_type,
classification,
@@ -135,7 +135,7 @@ func (p *Document) LoadByIDWithFilter(
SELECT
id,
organization_id,
owner_profile_id,
approver_profile_id,
title,
document_type,
classification,
@@ -188,7 +188,7 @@ func (p *Documents) LoadByIDs(
SELECT
id,
organization_id,
owner_profile_id,
approver_profile_id,
title,
document_type,
classification,
@@ -270,7 +270,7 @@ func (p *Documents) LoadByOrganizationID(
SELECT
id,
organization_id,
owner_profile_id,
approver_profile_id,
title,
document_type,
classification,
@@ -321,7 +321,7 @@ func (p *Documents) LoadAllByOrganizationID(
SELECT
id,
organization_id,
owner_profile_id,
approver_profile_id,
title,
document_type,
classification,
@@ -371,7 +371,7 @@ INSERT INTO
tenant_id,
id,
organization_id,
owner_profile_id,
approver_profile_id,
title,
document_type,
classification,
@@ -384,7 +384,7 @@ VALUES (
@tenant_id,
@document_id,
@organization_id,
@owner_profile_id,
@approver_profile_id,
@title,
@document_type,
@classification,
@@ -399,7 +399,7 @@ VALUES (
"tenant_id": scope.GetTenantID(),
"document_id": p.ID,
"organization_id": p.OrganizationID,
"owner_profile_id": p.OwnerID,
"approver_profile_id": p.ApproverID,
"title": p.Title,
"document_type": p.DocumentType,
"classification": p.Classification,
@@ -460,7 +460,7 @@ UPDATE
SET
title = @title,
current_published_version = @current_published_version,
owner_profile_id = @owner_profile_id,
approver_profile_id = @approver_profile_id,
document_type = @document_type,
classification = @classification,
trust_center_visibility = @trust_center_visibility,
@@ -477,7 +477,7 @@ WHERE
"updated_at": time.Now(),
"title": p.Title,
"current_published_version": p.CurrentPublishedVersion,
"owner_profile_id": p.OwnerID,
"approver_profile_id": p.ApproverID,
"document_type": p.DocumentType,
"classification": p.Classification,
"trust_center_visibility": p.TrustCenterVisibility,
@@ -548,7 +548,7 @@ WITH scoped_documents AS (
SELECT
scoped_documents.id,
scoped_documents.organization_id,
scoped_documents.owner_profile_id,
scoped_documents.approver_profile_id,
scoped_documents.title,
scoped_documents.document_type,
scoped_documents.classification,
@@ -638,7 +638,7 @@ WITH scoped_documents AS (
SELECT
scoped_documents.id,
scoped_documents.organization_id,
scoped_documents.owner_profile_id,
scoped_documents.approver_profile_id,
scoped_documents.title,
scoped_documents.document_type,
scoped_documents.classification,

View File

@@ -34,7 +34,7 @@ type (
OrganizationID gid.GID `db:"organization_id"`
DocumentID gid.GID `db:"document_id"`
Title string `db:"title"`
OwnerID gid.GID `db:"owner_profile_id"`
ApproverID gid.GID `db:"approver_profile_id"`
VersionNumber int `db:"version_number"`
Classification DocumentClassification `db:"classification"`
Content string `db:"content"`
@@ -77,7 +77,7 @@ SELECT
organization_id,
document_id,
title,
owner_profile_id,
approver_profile_id,
version_number,
classification,
content,
@@ -139,7 +139,7 @@ SELECT
organization_id,
document_id,
title,
owner_profile_id,
approver_profile_id,
version_number,
classification,
content,
@@ -190,7 +190,7 @@ INSERT INTO document_versions (
organization_id,
document_id,
title,
owner_profile_id,
approver_profile_id,
version_number,
classification,
content,
@@ -205,7 +205,7 @@ VALUES (
@organization_id,
@document_id,
@title,
@owner_profile_id,
@approver_profile_id,
@version_number,
@classification,
@content,
@@ -221,7 +221,7 @@ VALUES (
"organization_id": dv.OrganizationID,
"document_id": dv.DocumentID,
"title": dv.Title,
"owner_profile_id": dv.OwnerID,
"approver_profile_id": dv.ApproverID,
"version_number": dv.VersionNumber,
"classification": dv.Classification,
"content": dv.Content,
@@ -260,7 +260,7 @@ SELECT
organization_id,
document_id,
title,
owner_profile_id,
approver_profile_id,
version_number,
classification,
content,
@@ -313,7 +313,7 @@ SELECT
organization_id,
document_id,
title,
owner_profile_id,
approver_profile_id,
version_number,
classification,
content,
@@ -364,7 +364,7 @@ SELECT
organization_id,
document_id,
title,
owner_profile_id,
approver_profile_id,
version_number,
classification,
content,
@@ -413,7 +413,7 @@ func (dv DocumentVersion) Update(
q := `
UPDATE document_versions SET
title = @title,
owner_profile_id = @owner_profile_id,
approver_profile_id = @approver_profile_id,
changelog = @changelog,
status = @status,
content = @content,
@@ -429,7 +429,7 @@ WHERE %s
args := pgx.StrictNamedArgs{
"document_version_id": dv.ID,
"title": dv.Title,
"owner_profile_id": dv.OwnerID,
"approver_profile_id": dv.ApproverID,
"changelog": dv.Changelog,
"status": dv.Status,
"content": dv.Content,

View File

@@ -0,0 +1,5 @@
-- Rename owner_profile_id to approver_profile_id on documents table
ALTER TABLE documents RENAME COLUMN owner_profile_id TO approver_profile_id;
-- Rename owner_profile_id to approver_profile_id on document_versions table
ALTER TABLE document_versions RENAME COLUMN owner_profile_id TO approver_profile_id;

View File

@@ -50,7 +50,7 @@ type (
OrganizationID gid.GID
Title string
Content string
OwnerID gid.GID
ApproverID gid.GID
Classification coredata.DocumentClassification
DocumentType coredata.DocumentType
TrustCenterVisibility *coredata.TrustCenterVisibility
@@ -59,7 +59,7 @@ type (
UpdateDocumentRequest struct {
DocumentID gid.GID
Title *string
OwnerID *gid.GID
ApproverID *gid.GID
Classification *coredata.DocumentClassification
DocumentType *coredata.DocumentType
TrustCenterVisibility *coredata.TrustCenterVisibility
@@ -102,7 +102,7 @@ func (cdr *CreateDocumentRequest) Validate() error {
v.Check(cdr.OrganizationID, "organization_id", validator.Required(), validator.GID(coredata.OrganizationEntityType))
v.Check(cdr.Title, "title", validator.Required(), validator.SafeTextNoNewLine(TitleMaxLength))
v.Check(cdr.Content, "content", validator.Required(), validator.NotEmpty(), validator.MaxLen(documentMaxLength))
v.Check(cdr.OwnerID, "owner_id", validator.Required(), validator.GID(coredata.MembershipProfileEntityType))
v.Check(cdr.ApproverID, "approver_id", validator.Required(), validator.GID(coredata.MembershipProfileEntityType))
v.Check(cdr.Classification, "classification", validator.Required(), validator.OneOfSlice(coredata.DocumentClassifications()))
v.Check(cdr.DocumentType, "document_type", validator.Required(), validator.OneOfSlice(coredata.DocumentTypes()))
v.Check(cdr.TrustCenterVisibility, "trust_center_visibility", validator.OneOfSlice(coredata.TrustCenterVisibilities()))
@@ -115,7 +115,7 @@ func (udr *UpdateDocumentRequest) Validate() error {
v.Check(udr.DocumentID, "document_id", validator.Required(), validator.GID(coredata.DocumentEntityType))
v.Check(udr.Title, "title", validator.SafeTextNoNewLine(TitleMaxLength))
v.Check(udr.OwnerID, "owner_id", validator.GID(coredata.MembershipProfileEntityType))
v.Check(udr.ApproverID, "approver_id", validator.GID(coredata.MembershipProfileEntityType))
v.Check(udr.Classification, "classification", validator.OneOfSlice(coredata.DocumentClassifications()))
v.Check(udr.DocumentType, "document_type", validator.OneOfSlice(coredata.DocumentTypes()))
v.Check(udr.TrustCenterVisibility, "trust_center_visibility", validator.OneOfSlice(coredata.TrustCenterVisibilities()))
@@ -355,7 +355,7 @@ func (s *DocumentService) publishVersionInTx(
}
if publishedVersion.Content == documentVersion.Content &&
publishedVersion.Title == documentVersion.Title &&
publishedVersion.OwnerID == documentVersion.OwnerID {
publishedVersion.ApproverID == documentVersion.ApproverID {
return nil, nil, &ErrDocumentVersionNoChanges{}
}
}
@@ -395,7 +395,7 @@ func (s *DocumentService) Create(
documentVersionID := gid.New(s.svc.scope.GetTenantID(), coredata.DocumentVersionEntityType)
organization := &coredata.Organization{}
owner := &coredata.MembershipProfile{}
approver := &coredata.MembershipProfile{}
document := &coredata.Document{
ID: documentID,
@@ -415,7 +415,7 @@ func (s *DocumentService) Create(
ID: documentVersionID,
DocumentID: documentID,
Title: req.Title,
OwnerID: req.OwnerID,
ApproverID: req.ApproverID,
VersionNumber: 1,
Content: req.Content,
Status: coredata.DocumentStatusDraft,
@@ -431,12 +431,12 @@ func (s *DocumentService) Create(
return fmt.Errorf("cannot load organization: %w", err)
}
if err := owner.LoadByID(ctx, conn, s.svc.scope, req.OwnerID); err != nil {
return fmt.Errorf("cannot load owner profile: %w", err)
if err := approver.LoadByID(ctx, conn, s.svc.scope, req.ApproverID); err != nil {
return fmt.Errorf("cannot load approver profile: %w", err)
}
document.OrganizationID = organization.ID
document.OwnerID = owner.ID
document.ApproverID = approver.ID
if err := document.Insert(ctx, conn, s.svc.scope); err != nil {
return fmt.Errorf("cannot insert document: %w", err)
@@ -706,7 +706,7 @@ func (s *DocumentService) UpdateVersion(
}
documentVersion.Title = document.Title
documentVersion.OwnerID = document.OwnerID
documentVersion.ApproverID = document.ApproverID
documentVersion.Classification = document.Classification
documentVersion.Content = req.Content
documentVersion.UpdatedAt = time.Now()
@@ -944,7 +944,7 @@ func (s *DocumentService) CreateDraft(
draftVersion.OrganizationID = document.OrganizationID
draftVersion.DocumentID = documentID
draftVersion.Title = document.Title
draftVersion.OwnerID = document.OwnerID
draftVersion.ApproverID = document.ApproverID
draftVersion.VersionNumber = latestVersion.VersionNumber + 1
draftVersion.Classification = document.Classification
draftVersion.Content = latestVersion.Content
@@ -1384,7 +1384,7 @@ func (s *DocumentService) Update(
}
document := &coredata.Document{}
owner := &coredata.MembershipProfile{}
approver := &coredata.MembershipProfile{}
now := time.Now()
err := s.svc.pg.WithTx(
@@ -1414,11 +1414,11 @@ func (s *DocumentService) Update(
document.TrustCenterVisibility = *req.TrustCenterVisibility
}
if req.OwnerID != nil {
if err := owner.LoadByID(ctx, tx, s.svc.scope, *req.OwnerID); err != nil {
return fmt.Errorf("cannot load owner profile %q: %w", *req.OwnerID, err)
if req.ApproverID != nil {
if err := approver.LoadByID(ctx, tx, s.svc.scope, *req.ApproverID); err != nil {
return fmt.Errorf("cannot load approver profile %q: %w", *req.ApproverID, err)
}
document.OwnerID = owner.ID
document.ApproverID = approver.ID
}
document.UpdatedAt = now
@@ -1432,7 +1432,7 @@ func (s *DocumentService) Update(
err := draftVersion.LoadLatestVersion(ctx, tx, s.svc.scope, req.DocumentID)
if err == nil && draftVersion.Status == coredata.DocumentStatusDraft {
draftVersion.Title = document.Title
draftVersion.OwnerID = document.OwnerID
draftVersion.ApproverID = document.ApproverID
draftVersion.Classification = document.Classification
draftVersion.UpdatedAt = now
@@ -1638,7 +1638,7 @@ func exportDocumentPDF(
) ([]byte, error) {
document := &coredata.Document{}
version := &coredata.DocumentVersion{}
owner := &coredata.MembershipProfile{}
approver := &coredata.MembershipProfile{}
organization := &coredata.Organization{}
if err := version.LoadByID(ctx, conn, scope, documentVersionID); err != nil {
@@ -1649,8 +1649,8 @@ func exportDocumentPDF(
return nil, fmt.Errorf("cannot load document: %w", err)
}
if err := owner.LoadByID(ctx, conn, scope, document.OwnerID); err != nil {
return nil, fmt.Errorf("cannot load document owner profile: %w", err)
if err := approver.LoadByID(ctx, conn, scope, document.ApproverID); err != nil {
return nil, fmt.Errorf("cannot load document approver profile: %w", err)
}
if err := organization.LoadByID(ctx, conn, scope, document.OrganizationID); err != nil {
@@ -1702,7 +1702,7 @@ func exportDocumentPDF(
Content: version.Content,
Version: version.VersionNumber,
Classification: classification,
Approver: owner.FullName,
Approver: approver.FullName,
PublishedAt: version.PublishedAt,
Signatures: signatureData,
CompanyHorizontalLogoBase64: horizontalLogoBase64,

View File

@@ -2208,7 +2208,7 @@ type Document implements Node {
classification: DocumentClassification!
currentPublishedVersion: Int
trustCenterVisibility: TrustCenterVisibility!
owner: Profile! @goField(forceResolver: true)
approver: Profile! @goField(forceResolver: true)
organization: Organization! @goField(forceResolver: true)
versions(
@@ -4018,7 +4018,7 @@ input CreateDocumentInput {
organizationId: ID!
title: String!
content: String!
ownerId: ID!
approverId: ID!
documentType: DocumentType!
classification: DocumentClassification!
trustCenterVisibility: TrustCenterVisibility
@@ -4028,7 +4028,7 @@ input UpdateDocumentInput {
id: ID!
title: String
content: String
ownerId: ID
approverId: ID
documentType: DocumentType
classification: DocumentClassification
trustCenterVisibility: TrustCenterVisibility
@@ -4862,7 +4862,7 @@ type DocumentVersion implements Node {
changelog: String!
title: String!
classification: DocumentClassification!
owner: Profile! @goField(forceResolver: true)
approver: Profile! @goField(forceResolver: true)
signatures(
first: Int

View File

@@ -702,6 +702,7 @@ type ComplexityRoot struct {
}
Document struct {
Approver func(childComplexity int) int
Classification func(childComplexity int) int
Controls func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ControlOrderBy, filter *types.ControlFilter) int
CreatedAt func(childComplexity int) int
@@ -710,7 +711,6 @@ type ComplexityRoot struct {
DocumentType func(childComplexity int) int
ID func(childComplexity int) int
Organization func(childComplexity int) int
Owner func(childComplexity int) int
Permission func(childComplexity int, action string) int
Title func(childComplexity int) int
TrustCenterVisibility func(childComplexity int) int
@@ -730,13 +730,13 @@ type ComplexityRoot struct {
}
DocumentVersion struct {
Approver func(childComplexity int) int
Changelog func(childComplexity int) int
Classification func(childComplexity int) int
Content func(childComplexity int) int
CreatedAt func(childComplexity int) int
Document func(childComplexity int) int
ID func(childComplexity int) int
Owner func(childComplexity int) int
Permission func(childComplexity int, action string) int
PublishedAt func(childComplexity int) int
Signatures func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentVersionSignatureOrder, filter *types.DocumentVersionSignatureFilter) int
@@ -2058,7 +2058,7 @@ type DatumConnectionResolver interface {
TotalCount(ctx context.Context, obj *types.DatumConnection) (int, error)
}
type DocumentResolver interface {
Owner(ctx context.Context, obj *types.Document) (*types.Profile, error)
Approver(ctx context.Context, obj *types.Document) (*types.Profile, error)
Organization(ctx context.Context, obj *types.Document) (*types.Organization, error)
Versions(ctx context.Context, obj *types.Document, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentVersionOrderBy, filter *types.DocumentVersionFilter) (*types.DocumentVersionConnection, error)
Controls(ctx context.Context, obj *types.Document, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ControlOrderBy, filter *types.ControlFilter) (*types.ControlConnection, error)
@@ -2071,7 +2071,7 @@ type DocumentConnectionResolver interface {
type DocumentVersionResolver interface {
Document(ctx context.Context, obj *types.DocumentVersion) (*types.Document, error)
Owner(ctx context.Context, obj *types.DocumentVersion) (*types.Profile, error)
Approver(ctx context.Context, obj *types.DocumentVersion) (*types.Profile, error)
Signatures(ctx context.Context, obj *types.DocumentVersion, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentVersionSignatureOrder, filter *types.DocumentVersionSignatureFilter) (*types.DocumentVersionSignatureConnection, error)
Signed(ctx context.Context, obj *types.DocumentVersion) (bool, error)
@@ -4208,6 +4208,12 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
return e.complexity.DeleteWebhookSubscriptionPayload.DeletedWebhookSubscriptionID(childComplexity), true
case "Document.approver":
if e.complexity.Document.Approver == nil {
break
}
return e.complexity.Document.Approver(childComplexity), true
case "Document.classification":
if e.complexity.Document.Classification == nil {
break
@@ -4261,12 +4267,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
}
return e.complexity.Document.Organization(childComplexity), true
case "Document.owner":
if e.complexity.Document.Owner == nil {
break
}
return e.complexity.Document.Owner(childComplexity), true
case "Document.permission":
if e.complexity.Document.Permission == nil {
break
@@ -4340,6 +4340,12 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
return e.complexity.DocumentEdge.Node(childComplexity), true
case "DocumentVersion.approver":
if e.complexity.DocumentVersion.Approver == nil {
break
}
return e.complexity.DocumentVersion.Approver(childComplexity), true
case "DocumentVersion.changelog":
if e.complexity.DocumentVersion.Changelog == nil {
break
@@ -4376,12 +4382,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
}
return e.complexity.DocumentVersion.ID(childComplexity), true
case "DocumentVersion.owner":
if e.complexity.DocumentVersion.Owner == nil {
break
}
return e.complexity.DocumentVersion.Owner(childComplexity), true
case "DocumentVersion.permission":
if e.complexity.DocumentVersion.Permission == nil {
break
@@ -12795,7 +12795,7 @@ type Document implements Node {
classification: DocumentClassification!
currentPublishedVersion: Int
trustCenterVisibility: TrustCenterVisibility!
owner: Profile! @goField(forceResolver: true)
approver: Profile! @goField(forceResolver: true)
organization: Organization! @goField(forceResolver: true)
versions(
@@ -14605,7 +14605,7 @@ input CreateDocumentInput {
organizationId: ID!
title: String!
content: String!
ownerId: ID!
approverId: ID!
documentType: DocumentType!
classification: DocumentClassification!
trustCenterVisibility: TrustCenterVisibility
@@ -14615,7 +14615,7 @@ input UpdateDocumentInput {
id: ID!
title: String
content: String
ownerId: ID
approverId: ID
documentType: DocumentType
classification: DocumentClassification
trustCenterVisibility: TrustCenterVisibility
@@ -15449,7 +15449,7 @@ type DocumentVersion implements Node {
changelog: String!
title: String!
classification: DocumentClassification!
owner: Profile! @goField(forceResolver: true)
approver: Profile! @goField(forceResolver: true)
signatures(
first: Int
@@ -29115,14 +29115,14 @@ func (ec *executionContext) fieldContext_Document_trustCenterVisibility(_ contex
return fc, nil
}
func (ec *executionContext) _Document_owner(ctx context.Context, field graphql.CollectedField, obj *types.Document) (ret graphql.Marshaler) {
func (ec *executionContext) _Document_approver(ctx context.Context, field graphql.CollectedField, obj *types.Document) (ret graphql.Marshaler) {
return graphql.ResolveField(
ctx,
ec.OperationContext,
field,
ec.fieldContext_Document_owner,
ec.fieldContext_Document_approver,
func(ctx context.Context) (any, error) {
return ec.resolvers.Document().Owner(ctx, obj)
return ec.resolvers.Document().Approver(ctx, obj)
},
nil,
ec.marshalNProfile2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐProfile,
@@ -29131,7 +29131,7 @@ func (ec *executionContext) _Document_owner(ctx context.Context, field graphql.C
)
}
func (ec *executionContext) fieldContext_Document_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
func (ec *executionContext) fieldContext_Document_approver(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Document",
Field: field,
@@ -29642,8 +29642,8 @@ func (ec *executionContext) fieldContext_DocumentEdge_node(_ context.Context, fi
return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
case "trustCenterVisibility":
return ec.fieldContext_Document_trustCenterVisibility(ctx, field)
case "owner":
return ec.fieldContext_Document_owner(ctx, field)
case "approver":
return ec.fieldContext_Document_approver(ctx, field)
case "organization":
return ec.fieldContext_Document_organization(ctx, field)
case "versions":
@@ -29730,8 +29730,8 @@ func (ec *executionContext) fieldContext_DocumentVersion_document(_ context.Cont
return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
case "trustCenterVisibility":
return ec.fieldContext_Document_trustCenterVisibility(ctx, field)
case "owner":
return ec.fieldContext_Document_owner(ctx, field)
case "approver":
return ec.fieldContext_Document_approver(ctx, field)
case "organization":
return ec.fieldContext_Document_organization(ctx, field)
case "versions":
@@ -29925,14 +29925,14 @@ func (ec *executionContext) fieldContext_DocumentVersion_classification(_ contex
return fc, nil
}
func (ec *executionContext) _DocumentVersion_owner(ctx context.Context, field graphql.CollectedField, obj *types.DocumentVersion) (ret graphql.Marshaler) {
func (ec *executionContext) _DocumentVersion_approver(ctx context.Context, field graphql.CollectedField, obj *types.DocumentVersion) (ret graphql.Marshaler) {
return graphql.ResolveField(
ctx,
ec.OperationContext,
field,
ec.fieldContext_DocumentVersion_owner,
ec.fieldContext_DocumentVersion_approver,
func(ctx context.Context) (any, error) {
return ec.resolvers.DocumentVersion().Owner(ctx, obj)
return ec.resolvers.DocumentVersion().Approver(ctx, obj)
},
nil,
ec.marshalNProfile2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐProfile,
@@ -29941,7 +29941,7 @@ func (ec *executionContext) _DocumentVersion_owner(ctx context.Context, field gr
)
}
func (ec *executionContext) fieldContext_DocumentVersion_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
func (ec *executionContext) fieldContext_DocumentVersion_approver(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "DocumentVersion",
Field: field,
@@ -30356,8 +30356,8 @@ func (ec *executionContext) fieldContext_DocumentVersionEdge_node(_ context.Cont
return ec.fieldContext_DocumentVersion_title(ctx, field)
case "classification":
return ec.fieldContext_DocumentVersion_classification(ctx, field)
case "owner":
return ec.fieldContext_DocumentVersion_owner(ctx, field)
case "approver":
return ec.fieldContext_DocumentVersion_approver(ctx, field)
case "signatures":
return ec.fieldContext_DocumentVersion_signatures(ctx, field)
case "signed":
@@ -30446,8 +30446,8 @@ func (ec *executionContext) fieldContext_DocumentVersionSignature_documentVersio
return ec.fieldContext_DocumentVersion_title(ctx, field)
case "classification":
return ec.fieldContext_DocumentVersion_classification(ctx, field)
case "owner":
return ec.fieldContext_DocumentVersion_owner(ctx, field)
case "approver":
return ec.fieldContext_DocumentVersion_approver(ctx, field)
case "signatures":
return ec.fieldContext_DocumentVersion_signatures(ctx, field)
case "signed":
@@ -45461,8 +45461,8 @@ func (ec *executionContext) fieldContext_PublishDocumentVersionPayload_documentV
return ec.fieldContext_DocumentVersion_title(ctx, field)
case "classification":
return ec.fieldContext_DocumentVersion_classification(ctx, field)
case "owner":
return ec.fieldContext_DocumentVersion_owner(ctx, field)
case "approver":
return ec.fieldContext_DocumentVersion_approver(ctx, field)
case "signatures":
return ec.fieldContext_DocumentVersion_signatures(ctx, field)
case "signed":
@@ -45520,8 +45520,8 @@ func (ec *executionContext) fieldContext_PublishDocumentVersionPayload_document(
return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
case "trustCenterVisibility":
return ec.fieldContext_Document_trustCenterVisibility(ctx, field)
case "owner":
return ec.fieldContext_Document_owner(ctx, field)
case "approver":
return ec.fieldContext_Document_approver(ctx, field)
case "organization":
return ec.fieldContext_Document_organization(ctx, field)
case "versions":
@@ -52250,8 +52250,8 @@ func (ec *executionContext) fieldContext_TrustCenterDocumentAccess_document(_ co
return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
case "trustCenterVisibility":
return ec.fieldContext_Document_trustCenterVisibility(ctx, field)
case "owner":
return ec.fieldContext_Document_owner(ctx, field)
case "approver":
return ec.fieldContext_Document_approver(ctx, field)
case "organization":
return ec.fieldContext_Document_organization(ctx, field)
case "versions":
@@ -54047,8 +54047,8 @@ func (ec *executionContext) fieldContext_UpdateDocumentPayload_document(_ contex
return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
case "trustCenterVisibility":
return ec.fieldContext_Document_trustCenterVisibility(ctx, field)
case "owner":
return ec.fieldContext_Document_owner(ctx, field)
case "approver":
return ec.fieldContext_Document_approver(ctx, field)
case "organization":
return ec.fieldContext_Document_organization(ctx, field)
case "versions":
@@ -54108,8 +54108,8 @@ func (ec *executionContext) fieldContext_UpdateDocumentVersionPayload_documentVe
return ec.fieldContext_DocumentVersion_title(ctx, field)
case "classification":
return ec.fieldContext_DocumentVersion_classification(ctx, field)
case "owner":
return ec.fieldContext_DocumentVersion_owner(ctx, field)
case "approver":
return ec.fieldContext_DocumentVersion_approver(ctx, field)
case "signatures":
return ec.fieldContext_DocumentVersion_signatures(ctx, field)
case "signed":
@@ -63387,7 +63387,7 @@ func (ec *executionContext) unmarshalInputCreateDocumentInput(ctx context.Contex
asMap[k] = v
}
fieldsInOrder := [...]string{"organizationId", "title", "content", "ownerId", "documentType", "classification", "trustCenterVisibility"}
fieldsInOrder := [...]string{"organizationId", "title", "content", "approverId", "documentType", "classification", "trustCenterVisibility"}
for _, k := range fieldsInOrder {
v, ok := asMap[k]
if !ok {
@@ -63415,13 +63415,13 @@ func (ec *executionContext) unmarshalInputCreateDocumentInput(ctx context.Contex
return it, err
}
it.Content = data
case "ownerId":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerId"))
case "approverId":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("approverId"))
data, err := ec.unmarshalNID2goᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID(ctx, v)
if err != nil {
return it, err
}
it.OwnerID = data
it.ApproverID = data
case "documentType":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("documentType"))
data, err := ec.unmarshalNDocumentType2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐDocumentType(ctx, v)
@@ -68341,7 +68341,7 @@ func (ec *executionContext) unmarshalInputUpdateDocumentInput(ctx context.Contex
asMap[k] = v
}
fieldsInOrder := [...]string{"id", "title", "content", "ownerId", "documentType", "classification", "trustCenterVisibility"}
fieldsInOrder := [...]string{"id", "title", "content", "approverId", "documentType", "classification", "trustCenterVisibility"}
for _, k := range fieldsInOrder {
v, ok := asMap[k]
if !ok {
@@ -68369,13 +68369,13 @@ func (ec *executionContext) unmarshalInputUpdateDocumentInput(ctx context.Contex
return it, err
}
it.Content = data
case "ownerId":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerId"))
case "approverId":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("approverId"))
data, err := ec.unmarshalOID2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID(ctx, v)
if err != nil {
return it, err
}
it.OwnerID = data
it.ApproverID = data
case "documentType":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("documentType"))
data, err := ec.unmarshalODocumentType2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐDocumentType(ctx, v)
@@ -77056,7 +77056,7 @@ func (ec *executionContext) _Document(ctx context.Context, sel ast.SelectionSet,
if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1)
}
case "owner":
case "approver":
field := field
innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
@@ -77065,7 +77065,7 @@ func (ec *executionContext) _Document(ctx context.Context, sel ast.SelectionSet,
ec.Error(ctx, ec.Recover(ctx, r))
}
}()
res = ec._Document_owner(ctx, field, obj)
res = ec._Document_approver(ctx, field, obj)
if res == graphql.Null {
atomic.AddUint32(&fs.Invalids, 1)
}
@@ -77475,7 +77475,7 @@ func (ec *executionContext) _DocumentVersion(ctx context.Context, sel ast.Select
if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1)
}
case "owner":
case "approver":
field := field
innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
@@ -77484,7 +77484,7 @@ func (ec *executionContext) _DocumentVersion(ctx context.Context, sel ast.Select
ec.Error(ctx, ec.Recover(ctx, r))
}
}()
res = ec._DocumentVersion_owner(ctx, field, obj)
res = ec._DocumentVersion_approver(ctx, field, obj)
if res == graphql.Null {
atomic.AddUint32(&fs.Invalids, 1)
}

View File

@@ -80,8 +80,8 @@ func NewDocument(document *coredata.Document) *Document {
Organization: &Organization{
ID: document.OrganizationID,
},
Owner: &Profile{
ID: document.OwnerID,
Approver: &Profile{
ID: document.ApproverID,
},
DocumentType: document.DocumentType,
Classification: document.Classification,

View File

@@ -76,8 +76,8 @@ func NewDocumentVersion(documentVersion *coredata.DocumentVersion) *DocumentVers
Document: &Document{
ID: documentVersion.DocumentID,
},
Owner: &Profile{
ID: documentVersion.OwnerID,
Approver: &Profile{
ID: documentVersion.ApproverID,
},
Version: documentVersion.VersionNumber,
Title: documentVersion.Title,

View File

@@ -369,7 +369,7 @@ type CreateDocumentInput struct {
OrganizationID gid.GID `json:"organizationId"`
Title string `json:"title"`
Content string `json:"content"`
OwnerID gid.GID `json:"ownerId"`
ApproverID gid.GID `json:"approverId"`
DocumentType coredata.DocumentType `json:"documentType"`
Classification coredata.DocumentClassification `json:"classification"`
TrustCenterVisibility *coredata.TrustCenterVisibility `json:"trustCenterVisibility,omitempty"`
@@ -1129,7 +1129,7 @@ type Document struct {
Classification coredata.DocumentClassification `json:"classification"`
CurrentPublishedVersion *int `json:"currentPublishedVersion,omitempty"`
TrustCenterVisibility coredata.TrustCenterVisibility `json:"trustCenterVisibility"`
Owner *Profile `json:"owner"`
Approver *Profile `json:"approver"`
Organization *Organization `json:"organization"`
Versions *DocumentVersionConnection `json:"versions"`
Controls *ControlConnection `json:"controls"`
@@ -1159,7 +1159,7 @@ type DocumentVersion struct {
Changelog string `json:"changelog"`
Title string `json:"title"`
Classification coredata.DocumentClassification `json:"classification"`
Owner *Profile `json:"owner"`
Approver *Profile `json:"approver"`
Signatures *DocumentVersionSignatureConnection `json:"signatures"`
Signed bool `json:"signed"`
PublishedAt *time.Time `json:"publishedAt,omitempty"`
@@ -2036,7 +2036,7 @@ type UpdateDocumentInput struct {
ID gid.GID `json:"id"`
Title *string `json:"title,omitempty"`
Content *string `json:"content,omitempty"`
OwnerID *gid.GID `json:"ownerId,omitempty"`
ApproverID *gid.GID `json:"approverId,omitempty"`
DocumentType *coredata.DocumentType `json:"documentType,omitempty"`
Classification *coredata.DocumentClassification `json:"classification,omitempty"`
TrustCenterVisibility *coredata.TrustCenterVisibility `json:"trustCenterVisibility,omitempty"`

View File

@@ -862,23 +862,23 @@ func (r *datumConnectionResolver) TotalCount(ctx context.Context, obj *types.Dat
panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver))
}
// Owner is the resolver for the owner field.
func (r *documentResolver) Owner(ctx context.Context, obj *types.Document) (*types.Profile, error) {
// Approver is the resolver for the approver field.
func (r *documentResolver) Approver(ctx context.Context, obj *types.Document) (*types.Profile, error) {
if err := r.authorize(ctx, obj.ID, iam.ActionMembershipProfileGet); err != nil {
return nil, err
}
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID)
approver, err := r.iam.OrganizationService.GetProfile(ctx, obj.Approver.ID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFound(ctx, err)
}
// TODO no panic use gqlutils.InternalError
panic(fmt.Errorf("cannot get owner: %w", err))
panic(fmt.Errorf("cannot get approver: %w", err))
}
return types.NewProfile(owner), nil
return types.NewProfile(approver), nil
}
// Organization is the resolver for the organization field.
@@ -1031,23 +1031,23 @@ func (r *documentVersionResolver) Document(ctx context.Context, obj *types.Docum
return types.NewDocument(document), nil
}
// Owner is the resolver for the owner field.
func (r *documentVersionResolver) Owner(ctx context.Context, obj *types.DocumentVersion) (*types.Profile, error) {
// Approver is the resolver for the approver field.
func (r *documentVersionResolver) Approver(ctx context.Context, obj *types.DocumentVersion) (*types.Profile, error) {
if err := r.authorize(ctx, obj.ID, iam.ActionMembershipProfileGet); err != nil {
return nil, err
}
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID)
approver, err := r.iam.OrganizationService.GetProfile(ctx, obj.Approver.ID)
if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFound(ctx, err)
}
// TODO no panic use gqlutils.InternalError
panic(fmt.Errorf("cannot get owner: %w", err))
panic(fmt.Errorf("cannot get approver: %w", err))
}
return types.NewProfile(owner), nil
return types.NewProfile(approver), nil
}
// Signatures is the resolver for the signatures field.
@@ -3528,7 +3528,7 @@ func (r *mutationResolver) CreateDocument(ctx context.Context, input types.Creat
OrganizationID: input.OrganizationID,
DocumentType: input.DocumentType,
Title: input.Title,
OwnerID: input.OwnerID,
ApproverID: input.ApproverID,
Content: input.Content,
Classification: input.Classification,
TrustCenterVisibility: input.TrustCenterVisibility,
@@ -3562,7 +3562,7 @@ func (r *mutationResolver) UpdateDocument(ctx context.Context, input types.Updat
probo.UpdateDocumentRequest{
DocumentID: input.ID,
Title: input.Title,
OwnerID: input.OwnerID,
ApproverID: input.ApproverID,
Classification: input.Classification,
DocumentType: input.DocumentType,
TrustCenterVisibility: input.TrustCenterVisibility,

View File

@@ -1592,7 +1592,7 @@ func (r *Resolver) AddDocumentTool(ctx context.Context, req *mcp.CallToolRequest
OrganizationID: input.OrganizationID,
Title: input.Title,
Content: input.Content,
OwnerID: input.OwnerID,
ApproverID: input.ApproverID,
Classification: input.Classification,
DocumentType: input.DocumentType,
TrustCenterVisibility: trustCenterVisibility,
@@ -1615,7 +1615,7 @@ func (r *Resolver) UpdateDocumentTool(ctx context.Context, req *mcp.CallToolRequ
probo.UpdateDocumentRequest{
DocumentID: input.ID,
Title: input.Title,
OwnerID: input.OwnerID,
ApproverID: input.ApproverID,
Classification: input.Classification,
DocumentType: input.DocumentType,
TrustCenterVisibility: input.TrustCenterVisibility,

View File

@@ -23,7 +23,7 @@ func NewDocument(d *coredata.Document) *Document {
return &Document{
ID: d.ID,
OrganizationID: d.OrganizationID,
OwnerID: d.OwnerID,
ApproverID: d.ApproverID,
Title: d.Title,
DocumentType: d.DocumentType,
Classification: d.Classification,
@@ -65,7 +65,7 @@ func NewDocumentVersion(dv *coredata.DocumentVersion) *DocumentVersion {
OrganizationID: dv.OrganizationID,
DocumentID: dv.DocumentID,
Title: dv.Title,
OwnerID: dv.OwnerID,
ApproverID: dv.ApproverID,
VersionNumber: dv.VersionNumber,
Classification: dv.Classification,
Content: dv.Content,

View File

@@ -25,8 +25,8 @@ var (
AddControlToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"control":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"description":{"description":"Control description"},"exclusion_justification":{"description":"Exclusion justification"},"framework_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Control name"},"organization_id":{"type":"string","format":"string"},"section_title":{"type":"string","description":"Section title"},"status":{"type":"string","enum":["INCLUDED","EXCLUDED"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","framework_id","section_title","name","status","created_at","updated_at"]}},"required":["control"]}`)
AddDatumToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"data_classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"name":{"type":"string","description":"Datum name"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"vendor_ids":{"type":"array","items":{"type":"string","format":"string"},"description":"Vendor IDs"}},"required":["organization_id","name","data_classification","owner_id"]}`)
AddDatumToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"datum":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"data_classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Datum name"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"snapshot_id":{"description":"Snapshot ID","anyOf":[{"type":"string","format":"string"},{"type":"null","description":"No snapshot"}]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","name","data_classification","owner_id","created_at","updated_at"]}},"required":["datum"]}`)
AddDocumentToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"content":{"type":"string","description":"Document content"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]}},"required":["organization_id","title","content","owner_id","classification","document_type"]}`)
AddDocumentToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document":{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"current_published_version":{"description":"Current published version number"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","owner_id","title","document_type","classification","trust_center_visibility","created_at","updated_at"]},"document_version":{"type":"object","properties":{"changelog":{"type":"string","description":"Changelog"},"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"content":{"type":"string","description":"Document content"},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"document_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"published_at":{"description":"Published timestamp","format":"date-time"},"status":{"type":"string","enum":["DRAFT","PUBLISHED"]},"title":{"type":"string","description":"Document version title"},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"},"version_number":{"type":"integer","description":"Version number"}},"required":["id","organization_id","document_id","title","owner_id","version_number","classification","content","changelog","status","created_at","updated_at"]}},"required":["document","document_version"]}`)
AddDocumentToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"content":{"type":"string","description":"Document content"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"organization_id":{"type":"string","format":"string"},"approver_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]}},"required":["organization_id","title","content","approver_id","classification","document_type"]}`)
AddDocumentToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document":{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"current_published_version":{"description":"Current published version number"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"approver_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","approver_id","title","document_type","classification","trust_center_visibility","created_at","updated_at"]},"document_version":{"type":"object","properties":{"changelog":{"type":"string","description":"Changelog"},"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"content":{"type":"string","description":"Document content"},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"document_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"approver_id":{"type":"string","format":"string"},"published_at":{"description":"Published timestamp","format":"date-time"},"status":{"type":"string","enum":["DRAFT","PUBLISHED"]},"title":{"type":"string","description":"Document version title"},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"},"version_number":{"type":"integer","description":"Version number"}},"required":["id","organization_id","document_id","title","approver_id","version_number","classification","content","changelog","status","created_at","updated_at"]}},"required":["document","document_version"]}`)
AddFrameworkToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"description":{"type":"string","description":"Framework description"},"name":{"type":"string","description":"Framework name"},"organization_id":{"type":"string","format":"string"}},"required":["organization_id","name"]}`)
AddFrameworkToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"framework":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"description":{"description":"Framework description"},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Framework name"},"organization_id":{"type":"string","format":"string"},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","name","created_at","updated_at"]}},"required":["framework"]}`)
AddMeasureToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"category":{"type":"string","description":"Measure category"},"description":{"type":"string","description":"Measure description"},"name":{"type":"string","description":"Measure name"},"organization_id":{"type":"string","format":"string"}},"required":["organization_id","name","category"]}`)
@@ -70,7 +70,7 @@ var (
GetDatumToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"id":{"type":"string","format":"string"}},"required":["id"]}`)
GetDatumToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"datum":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"data_classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Datum name"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"snapshot_id":{"description":"Snapshot ID","anyOf":[{"type":"string","format":"string"},{"type":"null","description":"No snapshot"}]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","name","data_classification","owner_id","created_at","updated_at"]}},"required":["datum"]}`)
GetDocumentToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"id":{"type":"string","format":"string"}},"required":["id"]}`)
GetDocumentToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document":{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"current_published_version":{"description":"Current published version number"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","owner_id","title","document_type","classification","trust_center_visibility","created_at","updated_at"]}},"required":["document"]}`)
GetDocumentToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document":{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"current_published_version":{"description":"Current published version number"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"approver_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","approver_id","title","document_type","classification","trust_center_visibility","created_at","updated_at"]}},"required":["document"]}`)
GetDocumentVersionSignatureToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"id":{"type":"string","format":"string"}},"required":["id"]}`)
GetDocumentVersionSignatureToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document_version_signature":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"document_version_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"requested_at":{"type":"string","description":"Requested timestamp","format":"date-time"},"signed_at":{"description":"Signed timestamp","format":"date-time"},"signed_by":{"type":"string","format":"string"},"state":{"type":"string","enum":["REQUESTED","SIGNED"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","document_version_id","state","signed_by","requested_at","created_at","updated_at"]}},"required":["document_version_signature"]}`)
GetDocumentVersionToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"id":{"type":"string","format":"string"}},"required":["id"]}`)
@@ -114,9 +114,9 @@ var (
ListDocumentVersionSignaturesToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"cursor":{"type":"string","format":"string"},"document_version_id":{"type":"string","format":"string"},"filter":{"type":"object","properties":{"active_contract":{"type":"boolean","description":"Signatory contract status"},"states":{"type":"array","items":{"type":"string","enum":["REQUESTED","SIGNED"]},"description":"Signature states"}}},"order_by":{"type":"object","properties":{"direction":{"type":"string","enum":["ASC","DESC"]},"field":{"type":"string","enum":["CREATED_AT","SIGNED_AT"]}},"required":["field","direction"]},"size":{"type":"integer","description":"Page size"}},"required":["document_version_id"]}`)
ListDocumentVersionSignaturesToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document_version_signatures":{"type":"array","items":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"document_version_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"requested_at":{"type":"string","description":"Requested timestamp","format":"date-time"},"signed_at":{"description":"Signed timestamp","format":"date-time"},"signed_by":{"type":"string","format":"string"},"state":{"type":"string","enum":["REQUESTED","SIGNED"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","document_version_id","state","signed_by","requested_at","created_at","updated_at"]}},"next_cursor":{"type":"string","format":"string"}},"required":["document_version_signatures"]}`)
ListDocumentVersionsToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"cursor":{"type":"string","format":"string"},"document_id":{"type":"string","format":"string"},"order_by":{"type":"object","properties":{"direction":{"type":"string","enum":["ASC","DESC"]},"field":{"type":"string","enum":["CREATED_AT","VERSION"]}},"required":["field","direction"]},"size":{"type":"integer","description":"Page size"}},"required":["document_id"]}`)
ListDocumentVersionsToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document_versions":{"type":"array","items":{"type":"object","properties":{"changelog":{"type":"string","description":"Changelog"},"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"content":{"type":"string","description":"Document content"},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"document_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"published_at":{"description":"Published timestamp","format":"date-time"},"status":{"type":"string","enum":["DRAFT","PUBLISHED"]},"title":{"type":"string","description":"Document version title"},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"},"version_number":{"type":"integer","description":"Version number"}},"required":["id","organization_id","document_id","title","owner_id","version_number","classification","content","changelog","status","created_at","updated_at"]}},"next_cursor":{"type":"string","format":"string"}},"required":["document_versions"]}`)
ListDocumentVersionsToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document_versions":{"type":"array","items":{"type":"object","properties":{"changelog":{"type":"string","description":"Changelog"},"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"content":{"type":"string","description":"Document content"},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"document_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"approver_id":{"type":"string","format":"string"},"published_at":{"description":"Published timestamp","format":"date-time"},"status":{"type":"string","enum":["DRAFT","PUBLISHED"]},"title":{"type":"string","description":"Document version title"},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"},"version_number":{"type":"integer","description":"Version number"}},"required":["id","organization_id","document_id","title","approver_id","version_number","classification","content","changelog","status","created_at","updated_at"]}},"next_cursor":{"type":"string","format":"string"}},"required":["document_versions"]}`)
ListDocumentsToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"cursor":{"type":"string","format":"string"},"filter":{"type":"object","properties":{"query":{"type":"string","description":"Search query"},"trust_center_visibilities":{"type":"array","items":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]},"description":"Trust center visibilities"}}},"order_by":{"type":"object","properties":{"direction":{"type":"string","enum":["ASC","DESC"]},"field":{"type":"string","enum":["CREATED_AT","TITLE","DOCUMENT_TYPE"]}},"required":["field","direction"]},"organization_id":{"type":"string","format":"string"},"size":{"type":"integer","description":"Page size"}},"required":["organization_id"]}`)
ListDocumentsToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"documents":{"type":"array","items":{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"current_published_version":{"description":"Current published version number"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","owner_id","title","document_type","classification","trust_center_visibility","created_at","updated_at"]}},"next_cursor":{"type":"string","format":"string"}},"required":["documents"]}`)
ListDocumentsToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"documents":{"type":"array","items":{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"current_published_version":{"description":"Current published version number"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"approver_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","approver_id","title","document_type","classification","trust_center_visibility","created_at","updated_at"]}},"next_cursor":{"type":"string","format":"string"}},"required":["documents"]}`)
ListFrameworksToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"cursor":{"type":"string","format":"string"},"order_by":{"type":"object","properties":{"direction":{"type":"string","enum":["ASC","DESC"]},"field":{"type":"string","enum":["CREATED_AT"]}},"required":["field","direction"]},"organization_id":{"type":"string","format":"string"},"size":{"type":"integer","description":"Page size"}},"required":["organization_id"]}`)
ListFrameworksToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"frameworks":{"type":"array","items":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"description":{"description":"Framework description"},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Framework name"},"organization_id":{"type":"string","format":"string"},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","name","created_at","updated_at"]}},"next_cursor":{"type":"string","format":"string"}},"required":["frameworks"]}`)
ListMeasuresToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"cursor":{"type":"string","format":"string"},"filter":{"type":"object","properties":{"query":{"type":"string","description":"Search query"},"state":{"type":"string","enum":["NOT_STARTED","IN_PROGRESS","NOT_APPLICABLE","IMPLEMENTED"]}}},"order_by":{"type":"object","properties":{"direction":{"type":"string","enum":["ASC","DESC"]},"field":{"type":"string","enum":["CREATED_AT","NAME"]}},"required":["field","direction"]},"organization_id":{"type":"string","format":"string"},"size":{"type":"integer","description":"Page size"}},"required":["organization_id"]}`)
@@ -167,8 +167,8 @@ var (
UpdateControlToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"control":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"description":{"description":"Control description"},"exclusion_justification":{"description":"Exclusion justification"},"framework_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Control name"},"organization_id":{"type":"string","format":"string"},"section_title":{"type":"string","description":"Section title"},"status":{"type":"string","enum":["INCLUDED","EXCLUDED"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","framework_id","section_title","name","status","created_at","updated_at"]}},"required":["control"]}`)
UpdateDatumToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"data_classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Datum name"},"owner_id":{"description":"Owner ID","anyOf":[{"type":"string","format":"string"},{"type":"null"}]},"vendor_ids":{"type":"array","items":{"type":"string","format":"string"},"description":"Vendor IDs"}},"required":["id"]}`)
UpdateDatumToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"datum":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"data_classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Datum name"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"snapshot_id":{"description":"Snapshot ID","anyOf":[{"type":"string","format":"string"},{"type":"null","description":"No snapshot"}]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","name","data_classification","owner_id","created_at","updated_at"]}},"required":["datum"]}`)
UpdateDocumentToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]}},"required":["id"]}`)
UpdateDocumentToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document":{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"current_published_version":{"description":"Current published version number"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","owner_id","title","document_type","classification","trust_center_visibility","created_at","updated_at"]}},"required":["document"]}`)
UpdateDocumentToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"approver_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]}},"required":["id"]}`)
UpdateDocumentToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document":{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"current_published_version":{"description":"Current published version number"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"approver_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","approver_id","title","document_type","classification","trust_center_visibility","created_at","updated_at"]}},"required":["document"]}`)
UpdateDocumentVersionToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"content":{"type":"string","description":"Document content"},"document_version_id":{"type":"string","format":"string"}},"required":["document_version_id","content"]}`)
UpdateDocumentVersionToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document_version":{"type":"object","properties":{"changelog":{"type":"string","description":"Changelog"},"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"content":{"type":"string","description":"Document content"},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"document_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"published_at":{"description":"Published timestamp","format":"date-time"},"status":{"type":"string","enum":["DRAFT","PUBLISHED"]},"title":{"type":"string","description":"Document version title"},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"},"version_number":{"type":"integer","description":"Version number"}},"required":["id","organization_id","document_id","title","owner_id","version_number","classification","content","changelog","status","created_at","updated_at"]}},"required":["document_version"]}`)
UpdateFrameworkToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"description":{"description":"Framework description"},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Framework name"}},"required":["id"]}`)
@@ -612,8 +612,8 @@ type AddDocumentInput struct {
DocumentType coredata.DocumentType `json:"document_type"`
// Organization ID
OrganizationID gid.GID `json:"organization_id"`
// Owner ID
OwnerID gid.GID `json:"owner_id"`
// Approver ID
ApproverID gid.GID `json:"approver_id"`
// Document title
Title string `json:"title"`
// Trust center visibility
@@ -1102,8 +1102,8 @@ type Document struct {
ID gid.GID `json:"id"`
// Organization ID
OrganizationID gid.GID `json:"organization_id"`
// Owner ID
OwnerID gid.GID `json:"owner_id"`
// Approver ID
ApproverID gid.GID `json:"approver_id"`
// Document title
Title string `json:"title"`
// Trust center visibility
@@ -1136,8 +1136,8 @@ type DocumentVersion struct {
ID gid.GID `json:"id"`
// Organization ID
OrganizationID gid.GID `json:"organization_id"`
// Owner ID
OwnerID gid.GID `json:"owner_id"`
// Approver ID
ApproverID gid.GID `json:"approver_id"`
// Published timestamp
PublishedAt *time.Time `json:"published_at,omitempty"`
// Document status
@@ -2348,8 +2348,8 @@ type UpdateDocumentInput struct {
DocumentType *coredata.DocumentType `json:"document_type,omitempty"`
// Document ID
ID gid.GID `json:"id"`
// Owner ID
OwnerID *gid.GID `json:"owner_id,omitempty"`
// Approver ID
ApproverID *gid.GID `json:"approver_id,omitempty"`
// Document title
Title *string `json:"title,omitempty"`
// Trust center visibility

View File

@@ -142,7 +142,7 @@ func (s *DocumentService) exportPDFData(
) ([]byte, error) {
document := &coredata.Document{}
version := &coredata.DocumentVersion{}
owner := &coredata.MembershipProfile{}
approver := &coredata.MembershipProfile{}
organization := &coredata.Organization{}
err := s.svc.pg.WithConn(
@@ -160,8 +160,8 @@ func (s *DocumentService) exportPDFData(
return fmt.Errorf("cannot load latest published document version: %w", err)
}
if err := owner.LoadByID(ctx, conn, s.svc.scope, document.OwnerID); err != nil {
return fmt.Errorf("cannot load document owner profile: %w", err)
if err := approver.LoadByID(ctx, conn, s.svc.scope, document.ApproverID); err != nil {
return fmt.Errorf("cannot load document approver profile: %w", err)
}
if err := organization.LoadByID(ctx, conn, s.svc.scope, document.OrganizationID); err != nil {
@@ -203,7 +203,7 @@ func (s *DocumentService) exportPDFData(
Content: version.Content,
Version: version.VersionNumber,
Classification: classification,
Approver: owner.FullName,
Approver: approver.FullName,
PublishedAt: version.PublishedAt,
CompanyHorizontalLogoBase64: horizontalLogoBase64,
}