fix: cleanup

This commit is contained in:
David Nguyen
2025-10-13 16:02:22 +11:00
parent 6f70548bb5
commit 50572435ad
12 changed files with 53 additions and 35 deletions

View File

@ -257,7 +257,6 @@ const injectFormValuesIntoDocument = async (
id: envelopeItem.id,
},
data: {
// Todo: Envelopes [PRE-MAIN] - Should this also replace the initial data? Because if it's resealed we use the initial data thus lose the form values.
documentDataId: newDocumentData.id,
},
});

View File

@ -88,7 +88,7 @@ export const createEnvelopeFields = async ({
// The item to attach the fields to MUST belong to the document.
if (
field.envelopeItemId &&
!envelope.envelopeItems.find((envelopeItem) => envelopeItem.id === field.envelopeItemId) // Todo: Migration test this
!envelope.envelopeItems.find((envelopeItem) => envelopeItem.id === field.envelopeItemId)
) {
throw new AppError(AppErrorCode.INVALID_REQUEST, {
message: 'Item to attach fields to must belong to the document',

View File

@ -395,7 +395,6 @@ export const createDocumentFromTemplate = async ({
const oldEnvelopeItemToNewEnvelopeItemIdMap: Record<string, string> = {};
// Duplicate the envelope item data.
// Todo: Envelopes - Ask if it's okay to just use the documentDataId? Or should it be duplicated?
// Note: This is duplicated in createDocumentFromDirectTemplate
const envelopeItemsToCreate = await Promise.all(
template.envelopeItems.map(async (item, i) => {
@ -424,9 +423,6 @@ export const createDocumentFromTemplate = async ({
const buffer = await getFileServerSide(documentDataToDuplicate);
// Todo: Envelopes [PRE-MAIN] - Should we normalize? Should be part of the upload.
// const normalizedPdf = await makeNormalizedPdf(Buffer.from(buffer));
const titleToUse = item.title || finalEnvelopeTitle;
const duplicatedFile = await putPdfFileServerSide({