2023-06-09 18:21:18 +10:00
|
|
|
import { prisma } from '@documenso/prisma';
|
|
|
|
|
|
|
|
|
|
export interface GetDocumentByIdOptions {
|
|
|
|
|
id: number;
|
|
|
|
|
userId: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const getDocumentById = async ({ id, userId }: GetDocumentByIdOptions) => {
|
|
|
|
|
return await prisma.document.findFirstOrThrow({
|
|
|
|
|
where: {
|
|
|
|
|
id,
|
|
|
|
|
userId,
|
|
|
|
|
},
|
2023-09-07 19:27:21 +10:00
|
|
|
include: {
|
|
|
|
|
documentData: true,
|
|
|
|
|
},
|
2023-06-09 18:21:18 +10:00
|
|
|
});
|
|
|
|
|
};
|