fix: external id null for documents created from templates (#1362)

This commit is contained in:
Ephraim Duncan
2024-10-08 10:45:16 +00:00
committed by GitHub
parent e40f47a73c
commit cd3d9b701b
3 changed files with 9 additions and 6 deletions

View File

@ -1,8 +1,9 @@
import { nanoid } from '@documenso/lib/universal/id';
import { prisma } from '@documenso/prisma';
import type { DocumentSigningOrder, Field } from '@documenso/prisma/client';
import {
DocumentSigningOrder,
DocumentSource,
type Field,
type Recipient,
RecipientRole,
SendStatus,
@ -153,7 +154,7 @@ export const createDocumentFromTemplate = async ({
const document = await tx.document.create({
data: {
source: DocumentSource.TEMPLATE,
externalId,
externalId: externalId || template.externalId,
templateId: template.id,
userId,
teamId: template.teamId,
@ -172,7 +173,9 @@ export const createDocumentFromTemplate = async ({
dateFormat: override?.dateFormat || template.templateMeta?.dateFormat,
redirectUrl: override?.redirectUrl || template.templateMeta?.redirectUrl,
signingOrder:
override?.signingOrder || template.templateMeta?.signingOrder || undefined,
override?.signingOrder ||
template.templateMeta?.signingOrder ||
DocumentSigningOrder.PARALLEL,
},
},
Recipient: {

View File

@ -100,7 +100,7 @@ export const updateTemplateSettings = async ({
},
data: {
title: data.title,
externalId: data.externalId || null,
externalId: data.externalId,
type: data.type,
publicDescription: data.publicDescription,
publicTitle: data.publicTitle,