2023-09-22 12:27:54 +00:00
|
|
|
'use server';
|
|
|
|
|
|
|
|
|
|
import { prisma } from '@documenso/prisma';
|
|
|
|
|
|
|
|
|
|
export type CreateDocumentMetaOptions = {
|
|
|
|
|
documentId: number;
|
|
|
|
|
subject: string;
|
|
|
|
|
message: string;
|
2023-12-26 23:50:40 +00:00
|
|
|
timezone: string;
|
|
|
|
|
dateFormat: string;
|
2023-09-22 12:27:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const upsertDocumentMeta = async ({
|
|
|
|
|
subject,
|
|
|
|
|
message,
|
2023-12-26 23:50:40 +00:00
|
|
|
timezone,
|
|
|
|
|
dateFormat,
|
2023-09-22 12:27:54 +00:00
|
|
|
documentId,
|
|
|
|
|
}: CreateDocumentMetaOptions) => {
|
|
|
|
|
return await prisma.documentMeta.upsert({
|
|
|
|
|
where: {
|
|
|
|
|
documentId,
|
|
|
|
|
},
|
|
|
|
|
create: {
|
|
|
|
|
subject,
|
|
|
|
|
message,
|
2023-12-26 23:50:40 +00:00
|
|
|
dateFormat,
|
|
|
|
|
timezone,
|
2023-09-22 12:27:54 +00:00
|
|
|
documentId,
|
|
|
|
|
},
|
|
|
|
|
update: {
|
|
|
|
|
subject,
|
|
|
|
|
message,
|
2023-12-26 23:50:40 +00:00
|
|
|
dateFormat,
|
|
|
|
|
timezone,
|
2023-09-22 12:27:54 +00:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
};
|