feat: add document view page

This commit is contained in:
Ephraim Atta-Duncan
2025-01-30 10:12:25 +00:00
parent edfb1f2157
commit d82a759acd
5 changed files with 181 additions and 0 deletions

View File

@ -0,0 +1,27 @@
import { prisma } from '@documenso/prisma';
export type GetDocumentByAccessTokenOptions = {
token: string;
};
export const getDocumentByAccessToken = async ({ token }: GetDocumentByAccessTokenOptions) => {
if (!token) {
throw new Error('Missing token');
}
const result = await prisma.documentAccessToken.findFirstOrThrow({
where: {
token,
},
include: {
document: {
include: {
documentData: true,
documentMeta: true,
},
},
},
});
return result;
};