Files
documenso/packages/lib/server-only/attachment/find-template-attachments.ts
2025-07-07 16:10:41 +03:00

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;
};