mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
fix: external id null for documents created from templates (#1362)
This commit is contained in:
@ -1,8 +1,9 @@
|
|||||||
import { nanoid } from '@documenso/lib/universal/id';
|
import { nanoid } from '@documenso/lib/universal/id';
|
||||||
import { prisma } from '@documenso/prisma';
|
import { prisma } from '@documenso/prisma';
|
||||||
import type { DocumentSigningOrder, Field } from '@documenso/prisma/client';
|
|
||||||
import {
|
import {
|
||||||
|
DocumentSigningOrder,
|
||||||
DocumentSource,
|
DocumentSource,
|
||||||
|
type Field,
|
||||||
type Recipient,
|
type Recipient,
|
||||||
RecipientRole,
|
RecipientRole,
|
||||||
SendStatus,
|
SendStatus,
|
||||||
@ -153,7 +154,7 @@ export const createDocumentFromTemplate = async ({
|
|||||||
const document = await tx.document.create({
|
const document = await tx.document.create({
|
||||||
data: {
|
data: {
|
||||||
source: DocumentSource.TEMPLATE,
|
source: DocumentSource.TEMPLATE,
|
||||||
externalId,
|
externalId: externalId || template.externalId,
|
||||||
templateId: template.id,
|
templateId: template.id,
|
||||||
userId,
|
userId,
|
||||||
teamId: template.teamId,
|
teamId: template.teamId,
|
||||||
@ -172,7 +173,9 @@ export const createDocumentFromTemplate = async ({
|
|||||||
dateFormat: override?.dateFormat || template.templateMeta?.dateFormat,
|
dateFormat: override?.dateFormat || template.templateMeta?.dateFormat,
|
||||||
redirectUrl: override?.redirectUrl || template.templateMeta?.redirectUrl,
|
redirectUrl: override?.redirectUrl || template.templateMeta?.redirectUrl,
|
||||||
signingOrder:
|
signingOrder:
|
||||||
override?.signingOrder || template.templateMeta?.signingOrder || undefined,
|
override?.signingOrder ||
|
||||||
|
template.templateMeta?.signingOrder ||
|
||||||
|
DocumentSigningOrder.PARALLEL,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Recipient: {
|
Recipient: {
|
||||||
|
|||||||
@ -100,7 +100,7 @@ export const updateTemplateSettings = async ({
|
|||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
title: data.title,
|
title: data.title,
|
||||||
externalId: data.externalId || null,
|
externalId: data.externalId,
|
||||||
type: data.type,
|
type: data.type,
|
||||||
publicDescription: data.publicDescription,
|
publicDescription: data.publicDescription,
|
||||||
publicTitle: data.publicTitle,
|
publicTitle: data.publicTitle,
|
||||||
|
|||||||
@ -101,7 +101,7 @@ export const templateRouter = router({
|
|||||||
.input(ZCreateDocumentFromTemplateMutationSchema)
|
.input(ZCreateDocumentFromTemplateMutationSchema)
|
||||||
.mutation(async ({ input, ctx }) => {
|
.mutation(async ({ input, ctx }) => {
|
||||||
try {
|
try {
|
||||||
const { templateId, teamId } = input;
|
const { templateId, teamId, recipients } = input;
|
||||||
|
|
||||||
const limits = await getServerLimits({ email: ctx.user.email, teamId });
|
const limits = await getServerLimits({ email: ctx.user.email, teamId });
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ export const templateRouter = router({
|
|||||||
templateId,
|
templateId,
|
||||||
teamId,
|
teamId,
|
||||||
userId: ctx.user.id,
|
userId: ctx.user.id,
|
||||||
recipients: input.recipients,
|
recipients,
|
||||||
requestMetadata,
|
requestMetadata,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user