mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
22 lines
416 B
TypeScript
22 lines
416 B
TypeScript
import { prisma } from '@documenso/prisma';
|
|
|
|
export type GetRecipientByIdOptions = {
|
|
id: number;
|
|
documentId: number;
|
|
};
|
|
|
|
export const getRecipientById = async ({ documentId, id }: GetRecipientByIdOptions) => {
|
|
const recipient = await prisma.recipient.findFirst({
|
|
where: {
|
|
documentId,
|
|
id,
|
|
},
|
|
});
|
|
|
|
if (!recipient) {
|
|
throw new Error('Recipient not found');
|
|
}
|
|
|
|
return recipient;
|
|
};
|