mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 00:32:43 +10:00
27 lines
549 B
TypeScript
27 lines
549 B
TypeScript
import { prisma } from '@documenso/prisma';
|
|
|
|
import { buildTeamWhereQuery } from '../../utils/teams';
|
|
|
|
export type FindTemplateAttachmentsOptions = {
|
|
templateId: number;
|
|
userId: number;
|
|
teamId: number;
|
|
};
|
|
|
|
export const findTemplateAttachments = async ({
|
|
templateId,
|
|
userId,
|
|
teamId,
|
|
}: FindTemplateAttachmentsOptions) => {
|
|
const attachments = await prisma.attachment.findMany({
|
|
where: {
|
|
template: {
|
|
id: templateId,
|
|
team: buildTeamWhereQuery({ teamId, userId }),
|
|
},
|
|
},
|
|
});
|
|
|
|
return attachments;
|
|
};
|