Keep allowing to pass content on document creation for use cases other than frontend app
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -74,6 +74,7 @@ func createTestDocument(t *testing.T, owner *testutil.Client) (docID string, doc
|
||||
"organizationId": owner.GetOrganizationID().String(),
|
||||
"title": "Test Document",
|
||||
"content": "Initial content",
|
||||
"approverIds": []string{profileID},
|
||||
"documentType": "POLICY",
|
||||
"classification": "INTERNAL",
|
||||
},
|
||||
@@ -269,34 +270,28 @@ func TestDocumentVersion_UpdateContent(t *testing.T) {
|
||||
_, draftVersionID := createTestDocument(t, owner)
|
||||
|
||||
query := `
|
||||
mutation UpdateDocumentVersion($input: UpdateDocumentVersionInput!) {
|
||||
updateDocumentVersion(input: $input) {
|
||||
documentVersion {
|
||||
id
|
||||
content
|
||||
}
|
||||
mutation UpdateDocumentVersion($input: UpdateDocumentVersionContentInput!) {
|
||||
updateDocumentVersionContent(input: $input) {
|
||||
content
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
var result struct {
|
||||
UpdateDocumentVersion struct {
|
||||
DocumentVersion struct {
|
||||
ID string `json:"id"`
|
||||
Content string `json:"content"`
|
||||
} `json:"documentVersion"`
|
||||
} `json:"updateDocumentVersion"`
|
||||
UpdateDocumentVersionContent struct {
|
||||
Content string `json:"content"`
|
||||
} `json:"updateDocumentVersionContent"`
|
||||
}
|
||||
|
||||
err := owner.Execute(query, map[string]any{
|
||||
"input": map[string]any{
|
||||
"documentVersionId": draftVersionID,
|
||||
"content": "Updated content for the document",
|
||||
"id": draftVersionID,
|
||||
"content": "Updated content for the document version",
|
||||
},
|
||||
}, &result)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, "Updated content for the document", result.UpdateDocumentVersion.DocumentVersion.Content)
|
||||
assert.Equal(t, "Updated content for the document version", result.UpdateDocumentVersionContent.Content)
|
||||
}
|
||||
|
||||
func TestDocumentVersion_RequestSignature(t *testing.T) {
|
||||
|
||||
@@ -845,7 +845,6 @@ func CreateDocument(c *testutil.Client, attrs ...Attrs) string {
|
||||
input := map[string]any{
|
||||
"organizationId": c.GetOrganizationID().String(),
|
||||
"title": a.getString("title", SafeName("Document")),
|
||||
"content": a.getString("content", "Document content"),
|
||||
"documentType": a.getString("documentType", "POLICY"),
|
||||
"classification": a.getString("classification", "INTERNAL"),
|
||||
}
|
||||
|
||||
@@ -4472,7 +4472,7 @@ input DeleteVendorDataPrivacyAgreementInput {
|
||||
input CreateDocumentInput {
|
||||
organizationId: ID!
|
||||
title: String!
|
||||
content: String!
|
||||
content: String
|
||||
approverIds: [ID!]!
|
||||
documentType: DocumentType!
|
||||
classification: DocumentClassification!
|
||||
|
||||
@@ -4622,13 +4622,18 @@ func (r *mutationResolver) CreateDocument(ctx context.Context, input types.Creat
|
||||
|
||||
prb := r.ProboService(ctx, input.OrganizationID.TenantID())
|
||||
|
||||
var content string
|
||||
if input.Content != nil {
|
||||
content = *input.Content
|
||||
}
|
||||
|
||||
document, documentVersion, err := prb.Documents.Create(
|
||||
ctx,
|
||||
probo.CreateDocumentRequest{
|
||||
OrganizationID: input.OrganizationID,
|
||||
DocumentType: input.DocumentType,
|
||||
Title: input.Title,
|
||||
Content: input.Content,
|
||||
Content: content,
|
||||
ApproverIDs: input.ApproverIds,
|
||||
Classification: input.Classification,
|
||||
TrustCenterVisibility: input.TrustCenterVisibility,
|
||||
|
||||
Reference in New Issue
Block a user