mirror of
https://github.com/documenso/documenso.git
synced 2025-11-10 04:22:32 +10:00
26 lines
459 B
TypeScript
26 lines
459 B
TypeScript
import { prisma } from '@documenso/prisma';
|
|
|
|
export interface GetRecipientsForTemplateOptions {
|
|
templateId: number;
|
|
userId: number;
|
|
}
|
|
|
|
export const getRecipientsForTemplate = async ({
|
|
templateId,
|
|
userId,
|
|
}: GetRecipientsForTemplateOptions) => {
|
|
const recipients = await prisma.recipient.findMany({
|
|
where: {
|
|
templateId,
|
|
Template: {
|
|
userId,
|
|
},
|
|
},
|
|
orderBy: {
|
|
id: 'asc',
|
|
},
|
|
});
|
|
|
|
return recipients;
|
|
};
|