mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
fix: improve document meta logic
This commit is contained in:
@ -8,6 +8,7 @@ export type CreateDocumentMetaOptions = {
|
|||||||
message: string;
|
message: string;
|
||||||
timezone: string;
|
timezone: string;
|
||||||
dateFormat: string;
|
dateFormat: string;
|
||||||
|
userId: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const upsertDocumentMeta = async ({
|
export const upsertDocumentMeta = async ({
|
||||||
@ -16,7 +17,15 @@ export const upsertDocumentMeta = async ({
|
|||||||
timezone,
|
timezone,
|
||||||
dateFormat,
|
dateFormat,
|
||||||
documentId,
|
documentId,
|
||||||
|
userId,
|
||||||
}: CreateDocumentMetaOptions) => {
|
}: CreateDocumentMetaOptions) => {
|
||||||
|
await prisma.document.findFirstOrThrow({
|
||||||
|
where: {
|
||||||
|
id: documentId,
|
||||||
|
userId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
return await prisma.documentMeta.upsert({
|
return await prisma.documentMeta.upsert({
|
||||||
where: {
|
where: {
|
||||||
documentId,
|
documentId,
|
||||||
|
|||||||
@ -188,6 +188,7 @@ export const documentRouter = router({
|
|||||||
message: meta.message,
|
message: meta.message,
|
||||||
dateFormat: meta.dateFormat,
|
dateFormat: meta.dateFormat,
|
||||||
timezone: meta.timezone,
|
timezone: meta.timezone,
|
||||||
|
userId: ctx.user.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user