mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 08:42:12 +10:00
23 lines
518 B
TypeScript
23 lines
518 B
TypeScript
import { prisma } from '@documenso/prisma';
|
|
|
|
import { buildTeamWhereQuery } from '../../utils/teams';
|
|
|
|
export type FindAttachmentsOptions = {
|
|
documentId: number;
|
|
userId: number;
|
|
teamId: number;
|
|
};
|
|
|
|
export const findAttachments = async ({ documentId, userId, teamId }: FindAttachmentsOptions) => {
|
|
const attachments = await prisma.attachment.findMany({
|
|
where: {
|
|
document: {
|
|
id: documentId,
|
|
team: buildTeamWhereQuery({ teamId, userId }),
|
|
},
|
|
},
|
|
});
|
|
|
|
return attachments;
|
|
};
|