mirror of
https://github.com/documenso/documenso.git
synced 2026-07-07 11:35:01 +10:00
f3f5903760
Merge origin/main into feat/document-file-conversion. Conflicts were format-only (Tailwind class ordering, single-line vs multi-line) plus two semantic merges: - files.helpers.ts: combine main's pending-PDF download path with the branch's original-source-file (DOCX/PNG/JPEG) download path - download-pdf.ts: combine main's versionToFilenameSuffix helper with the branch's server-provided Content-Disposition filename support
35 lines
728 B
TypeScript
35 lines
728 B
TypeScript
import { prisma } from '@documenso/prisma';
|
|
import type { DocumentDataType } from '@prisma/client';
|
|
|
|
export type CreateDocumentDataOptions = {
|
|
type: DocumentDataType;
|
|
data: string;
|
|
|
|
/**
|
|
* The initial data that was used to create the document data.
|
|
*
|
|
* If not provided, the current data will be used.
|
|
*/
|
|
initialData?: string;
|
|
originalData?: string;
|
|
originalMimeType?: string;
|
|
};
|
|
|
|
export const createDocumentData = async ({
|
|
type,
|
|
data,
|
|
initialData,
|
|
originalData,
|
|
originalMimeType,
|
|
}: CreateDocumentDataOptions) => {
|
|
return await prisma.documentData.create({
|
|
data: {
|
|
type,
|
|
data,
|
|
initialData: initialData || data,
|
|
originalData,
|
|
originalMimeType,
|
|
},
|
|
});
|
|
};
|