feat: download doc without signing certificate (#1477)

## Description

I added the option of downloading a document without the signing
certificate for teams. They can disable/enable the option in the
preferences tab.

The signing certificate can still be downloaded separately from the
`logs` page.
This commit is contained in:
Catalin Pit
2024-11-25 06:47:26 +02:00
committed by GitHub
parent b15e1d6c47
commit fa33f83696
22 changed files with 624 additions and 201 deletions

View File

@ -57,7 +57,17 @@ export const SEAL_DOCUMENT_JOB_DEFINITION = {
},
},
include: {
documentMeta: true,
Recipient: true,
team: {
select: {
teamGlobalSettings: {
select: {
includeSigningCertificate: true,
},
},
},
},
},
});
@ -117,7 +127,13 @@ export const SEAL_DOCUMENT_JOB_DEFINITION = {
}
const pdfData = await getFile(documentData);
const certificateData = await getCertificatePdf({ documentId }).catch(() => null);
const certificateData =
document.team?.teamGlobalSettings?.includeSigningCertificate ?? true
? await getCertificatePdf({
documentId,
language: document.documentMeta?.language,
}).catch(() => null)
: null;
const newDataId = await io.runTask('decorate-and-sign-pdf', async () => {
const pdfDoc = await PDFDocument.load(pdfData);