mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
25 lines
567 B
TypeScript
25 lines
567 B
TypeScript
'use server';
|
|
|
|
import { z } from 'zod';
|
|
|
|
import { getRequiredServerComponentSession } from '@documenso/lib/next-auth/get-server-session';
|
|
import { prisma } from '@documenso/prisma';
|
|
|
|
export async function updateRecipientReadStatus(recipientId: number, documentId: number) {
|
|
z.number().parse(recipientId);
|
|
z.number().parse(documentId);
|
|
|
|
const { email } = await getRequiredServerComponentSession();
|
|
|
|
await prisma.recipient.update({
|
|
where: {
|
|
id: recipientId,
|
|
documentId,
|
|
email,
|
|
},
|
|
data: {
|
|
readStatus: 'OPENED',
|
|
},
|
|
});
|
|
}
|