2023-09-07 19:27:21 +10:00
|
|
|
'use server';
|
|
|
|
|
|
2023-09-14 12:46:36 +10:00
|
|
|
import { prisma } from '@documenso/prisma';
|
|
|
|
|
|
2023-09-07 19:27:21 +10:00
|
|
|
export type CreateDocumentOptions = {
|
2023-09-14 12:46:36 +10:00
|
|
|
title: string;
|
2023-09-07 19:27:21 +10:00
|
|
|
userId: number;
|
2023-09-14 12:46:36 +10:00
|
|
|
documentDataId: string;
|
2023-09-07 19:27:21 +10:00
|
|
|
};
|
|
|
|
|
|
2023-09-14 12:46:36 +10:00
|
|
|
export const createDocument = async ({ userId, title, documentDataId }: CreateDocumentOptions) => {
|
|
|
|
|
return await prisma.document.create({
|
|
|
|
|
data: {
|
|
|
|
|
title,
|
|
|
|
|
documentDataId,
|
|
|
|
|
userId,
|
|
|
|
|
},
|
|
|
|
|
});
|
2023-09-07 19:27:21 +10:00
|
|
|
};
|