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