mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 16:51:38 +10:00
fix: asdf
This commit is contained in:
@ -112,28 +112,47 @@ export const sealDocument = async ({
|
|||||||
doc.getForm().flatten();
|
doc.getForm().flatten();
|
||||||
flattenAnnotations(doc);
|
flattenAnnotations(doc);
|
||||||
|
|
||||||
|
const certificatePageTime = Date.now();
|
||||||
|
console.log('certificatePageStart:' + certificatePageTime);
|
||||||
|
|
||||||
const certificatePages = await doc.copyPages(certificate, certificate.getPageIndices());
|
const certificatePages = await doc.copyPages(certificate, certificate.getPageIndices());
|
||||||
|
console.log('certificatePageEnd:' + (Date.now() - certificatePageTime));
|
||||||
|
|
||||||
certificatePages.forEach((page) => {
|
certificatePages.forEach((page) => {
|
||||||
doc.addPage(page);
|
doc.addPage(page);
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const field of fields) {
|
for (const field of fields) {
|
||||||
|
const insertFIeldTime = Date.now();
|
||||||
|
console.log('insertFieldStart:' + insertFIeldTime);
|
||||||
await insertFieldInPDF(doc, field);
|
await insertFieldInPDF(doc, field);
|
||||||
|
console.log('insertFieldEnd:' + (Date.now() - insertFIeldTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
const pdfBytes = await doc.save();
|
const docSaveTime = Date.now();
|
||||||
|
console.log('docSaveStart:' + docSaveTime);
|
||||||
|
|
||||||
|
const pdfBytes = await doc.save();
|
||||||
|
console.log('docSaveEnd:' + (Date.now() - docSaveTime));
|
||||||
|
|
||||||
|
const pdfBufferTIme = Date.now();
|
||||||
|
console.log('pdfBufferStart:' + pdfBufferTIme);
|
||||||
const pdfBuffer = await signPdf({ pdf: Buffer.from(pdfBytes) });
|
const pdfBuffer = await signPdf({ pdf: Buffer.from(pdfBytes) });
|
||||||
|
console.log('pdfBufferEnd:' + (Date.now() - pdfBufferTIme));
|
||||||
|
|
||||||
const { name, ext } = path.parse(document.title);
|
const { name, ext } = path.parse(document.title);
|
||||||
|
|
||||||
|
const putFIleTIme = Date.now();
|
||||||
|
console.log('putFileStart:' + putFIleTIme);
|
||||||
|
|
||||||
const { data: newData } = await putFile({
|
const { data: newData } = await putFile({
|
||||||
name: `${name}_signed${ext}`,
|
name: `${name}_signed${ext}`,
|
||||||
type: 'application/pdf',
|
type: 'application/pdf',
|
||||||
arrayBuffer: async () => Promise.resolve(pdfBuffer),
|
arrayBuffer: async () => Promise.resolve(pdfBuffer),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log('putFileEnd:' + (Date.now() - putFIleTIme));
|
||||||
|
|
||||||
const postHog = PostHogServerClient();
|
const postHog = PostHogServerClient();
|
||||||
|
|
||||||
if (postHog) {
|
if (postHog) {
|
||||||
@ -146,6 +165,9 @@ export const sealDocument = async ({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const updateDocumentTime = Date.now();
|
||||||
|
console.log('updateDocumentStart:' + updateDocumentTime);
|
||||||
|
|
||||||
await prisma.$transaction(async (tx) => {
|
await prisma.$transaction(async (tx) => {
|
||||||
await tx.documentData.update({
|
await tx.documentData.update({
|
||||||
where: {
|
where: {
|
||||||
@ -169,10 +191,18 @@ export const sealDocument = async ({
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log('updateDocumentEnd:' + (Date.now() - updateDocumentTime));
|
||||||
|
|
||||||
if (sendEmail && !isResealing) {
|
if (sendEmail && !isResealing) {
|
||||||
|
const sendCompleteEmailTime = Date.now();
|
||||||
|
console.log('sendCompleteEmailStart:' + sendCompleteEmailTime);
|
||||||
await sendCompletedEmail({ documentId, requestMetadata });
|
await sendCompletedEmail({ documentId, requestMetadata });
|
||||||
|
console.log('sendCompleteEmailEnd:' + (Date.now() - sendCompleteEmailTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const asdfasdfasdf = Date.now();
|
||||||
|
console.log('updateDocumentStart:' + asdfasdfasdf);
|
||||||
|
|
||||||
const updatedDocument = await prisma.document.findFirstOrThrow({
|
const updatedDocument = await prisma.document.findFirstOrThrow({
|
||||||
where: {
|
where: {
|
||||||
id: document.id,
|
id: document.id,
|
||||||
@ -182,6 +212,10 @@ export const sealDocument = async ({
|
|||||||
Recipient: true,
|
Recipient: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
console.log('updateDocumentEnd:' + (Date.now() - asdfasdfasdf));
|
||||||
|
|
||||||
|
const triggerWebhookTime = Date.now();
|
||||||
|
console.log('triggerWebhookStart:' + triggerWebhookTime);
|
||||||
|
|
||||||
await triggerWebhook({
|
await triggerWebhook({
|
||||||
event: WebhookTriggerEvents.DOCUMENT_COMPLETED,
|
event: WebhookTriggerEvents.DOCUMENT_COMPLETED,
|
||||||
@ -189,4 +223,5 @@ export const sealDocument = async ({
|
|||||||
userId: document.userId,
|
userId: document.userId,
|
||||||
teamId: document.teamId ?? undefined,
|
teamId: document.teamId ?? undefined,
|
||||||
});
|
});
|
||||||
|
console.log('triggerWebhookEnd:' + (Date.now() - triggerWebhookTime));
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user