chore: revert changes based on feedback

This commit is contained in:
Catalin Pit
2025-07-07 12:04:20 +03:00
parent 52b474d12b
commit eb78706f35
9 changed files with 154 additions and 107 deletions

View File

@ -1,4 +1,4 @@
import type { Attachment, DocumentVisibility, Template, TemplateMeta } from '@prisma/client';
import type { DocumentVisibility, Template, TemplateMeta } from '@prisma/client';
import { prisma } from '@documenso/prisma';
@ -21,7 +21,6 @@ export type UpdateTemplateOptions = {
publicDescription?: string;
type?: Template['type'];
useLegacyFieldInsertion?: boolean;
attachments?: Pick<Attachment, 'id' | 'label' | 'url'>[];
};
meta?: Partial<Omit<TemplateMeta, 'id' | 'templateId'>>;
};
@ -40,7 +39,6 @@ export const updateTemplate = async ({
},
include: {
templateMeta: true,
attachments: true,
team: {
select: {
organisation: {
@ -100,29 +98,6 @@ export const updateTemplate = async ({
publicDescription: data?.publicDescription,
publicTitle: data?.publicTitle,
useLegacyFieldInsertion: data?.useLegacyFieldInsertion,
attachments: {
deleteMany: {
templateId,
id: {
notIn: data?.attachments?.map((attachment) => attachment.id),
},
},
upsert: data?.attachments?.map((attachment) => ({
where: {
id: attachment.id,
templateId,
},
update: {
label: attachment.label,
url: attachment.url,
},
create: {
id: attachment.id,
label: attachment.label,
url: attachment.url,
},
})),
},
authOptions,
templateMeta: {
upsert: {