Implement debounced auto save
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -3766,6 +3766,7 @@ type Mutation {
|
||||
updateDocument(input: UpdateDocumentInput!): UpdateDocumentPayload!
|
||||
archiveDocument(input: ArchiveDocumentInput!): ArchiveDocumentPayload!
|
||||
unarchiveDocument(input: UnarchiveDocumentInput!): UnarchiveDocumentPayload!
|
||||
updateDocumentVersionContent(input: UpdateDocumentVersionContentInput!): UpdateDocumentVersionContentPayload!
|
||||
deleteDocument(input: DeleteDocumentInput!): DeleteDocumentPayload!
|
||||
# Meeting mutations
|
||||
createMeeting(input: CreateMeetingInput!): CreateMeetingPayload!
|
||||
@@ -4472,6 +4473,7 @@ input CreateDocumentInput {
|
||||
organizationId: ID!
|
||||
title: String!
|
||||
content: String!
|
||||
approverIds: [ID!]!
|
||||
documentType: DocumentType!
|
||||
classification: DocumentClassification!
|
||||
trustCenterVisibility: TrustCenterVisibility
|
||||
@@ -4485,6 +4487,11 @@ input UpdateDocumentInput {
|
||||
trustCenterVisibility: TrustCenterVisibility
|
||||
}
|
||||
|
||||
input UpdateDocumentVersionContentInput {
|
||||
id: ID!
|
||||
content: String!
|
||||
}
|
||||
|
||||
input ExportDocumentVersionPDFInput {
|
||||
documentVersionId: ID!
|
||||
withWatermark: Boolean!
|
||||
@@ -5250,6 +5257,10 @@ type UnarchiveDocumentPayload {
|
||||
document: Document!
|
||||
}
|
||||
|
||||
type UpdateDocumentVersionContentPayload {
|
||||
content: String!
|
||||
}
|
||||
|
||||
type DeleteDocumentPayload {
|
||||
deletedDocumentId: ID!
|
||||
}
|
||||
|
||||
@@ -4629,6 +4629,7 @@ func (r *mutationResolver) CreateDocument(ctx context.Context, input types.Creat
|
||||
DocumentType: input.DocumentType,
|
||||
Title: input.Title,
|
||||
Content: input.Content,
|
||||
ApproverIDs: input.ApproverIds,
|
||||
Classification: input.Classification,
|
||||
TrustCenterVisibility: input.TrustCenterVisibility,
|
||||
},
|
||||
@@ -4729,6 +4730,36 @@ func (r *mutationResolver) UnarchiveDocument(ctx context.Context, input types.Un
|
||||
}, nil
|
||||
}
|
||||
|
||||
// UpdateDocumentVersionContent is the resolver for the updateDocumentVersionContent field.
|
||||
func (r *mutationResolver) UpdateDocumentVersionContent(ctx context.Context, input types.UpdateDocumentVersionContentInput) (*types.UpdateDocumentVersionContentPayload, error) {
|
||||
if err := r.authorize(ctx, input.ID, probo.ActionDocumentUpdate); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
prb := r.ProboService(ctx, input.ID.TenantID())
|
||||
|
||||
content, err := prb.Documents.UpdateDocumentVersionContent(
|
||||
ctx,
|
||||
probo.UpdateDocumentVersionRequest{
|
||||
ID: input.ID,
|
||||
Content: input.Content,
|
||||
},
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
if _, ok := errors.AsType[*probo.ErrDocumentVersionNotDraft](err); ok {
|
||||
return nil, gqlutils.Conflict(ctx, err)
|
||||
}
|
||||
|
||||
r.logger.ErrorCtx(ctx, "cannot update document version content", log.Error(err))
|
||||
return nil, gqlutils.Internal(ctx)
|
||||
}
|
||||
|
||||
return &types.UpdateDocumentVersionContentPayload{
|
||||
Content: content,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// DeleteDocument is the resolver for the deleteDocument field.
|
||||
func (r *mutationResolver) DeleteDocument(ctx context.Context, input types.DeleteDocumentInput) (*types.DeleteDocumentPayload, error) {
|
||||
if err := r.authorize(ctx, input.DocumentID, probo.ActionDocumentDelete); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user