feat: add get recipient route (#1553)

This commit is contained in:
David Nguyen
2024-12-26 17:25:14 +11:00
committed by GitHub
parent 8a7ec7e982
commit 74382e21e7
7 changed files with 119 additions and 18 deletions

View File

@@ -0,0 +1,21 @@
import { prisma } from '@documenso/prisma';
export type GetRecipientByIdOptions = {
id: number;
documentId: number;
};
export const getRecipientByIdV1Api = async ({ documentId, id }: GetRecipientByIdOptions) => {
const recipient = await prisma.recipient.findFirst({
where: {
documentId,
id,
},
});
if (!recipient) {
throw new Error('Recipient not found');
}
return recipient;
};