mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 08:42:12 +10:00
chore: template attachments
This commit is contained in:
@ -0,0 +1,28 @@
|
||||
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 }),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
console.log('attachments', attachments);
|
||||
|
||||
return attachments;
|
||||
};
|
||||
Reference in New Issue
Block a user