Files
documenso/packages/lib/server-only/document-data/create-document-data.ts
David Nguyen 8e8f57661c fix: refactors
2026-02-25 19:26:09 +11:00

30 lines
595 B
TypeScript

import type { DocumentDataType } from '@prisma/client';
import { prisma } from '@documenso/prisma';
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;
};
export const createDocumentData = async ({
type,
data,
initialData,
}: CreateDocumentDataOptions) => {
return await prisma.documentData.create({
data: {
type,
data,
initialData: initialData || data,
},
});
};