mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 16:23:06 +10:00
chore: template attachments
This commit is contained in:
@ -6,14 +6,12 @@ import { AppError } from '../../errors/app-error';
|
||||
import { AppErrorCode } from '../../errors/app-error';
|
||||
|
||||
export type CreateAttachmentsOptions = {
|
||||
documentId?: number;
|
||||
templateId?: number;
|
||||
documentId: number;
|
||||
attachments: Pick<Attachment, 'id' | 'label' | 'url' | 'type'>[];
|
||||
};
|
||||
|
||||
export const setDocumentAttachments = async ({
|
||||
documentId,
|
||||
templateId,
|
||||
attachments,
|
||||
}: CreateAttachmentsOptions) => {
|
||||
const document = await prisma.document.findUnique({
|
||||
@ -55,13 +53,11 @@ export const setDocumentAttachments = async ({
|
||||
label: attachment.label,
|
||||
url: attachment.url,
|
||||
type: attachment.type,
|
||||
templateId,
|
||||
},
|
||||
create: {
|
||||
label: attachment.label,
|
||||
url: attachment.url,
|
||||
type: attachment.type,
|
||||
templateId,
|
||||
documentId,
|
||||
},
|
||||
});
|
||||
@ -72,7 +68,6 @@ export const setDocumentAttachments = async ({
|
||||
label: attachment.label,
|
||||
url: attachment.url,
|
||||
type: attachment.type,
|
||||
templateId,
|
||||
documentId,
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user