feat: return the necessary information for document preview and download

This commit is contained in:
Ephraim Atta-Duncan
2025-01-30 10:29:22 +00:00
parent 6743a108c0
commit 810d194cfd
2 changed files with 17 additions and 5 deletions

View File

@ -10,7 +10,7 @@ import { Button } from '@documenso/ui/primitives/button';
import { useToast } from '@documenso/ui/primitives/use-toast';
export type DocumentDownloadButtonProps = {
document: Document & {
document: Pick<Document, 'title'> & {
documentData: DocumentData;
};
};

View File

@ -13,11 +13,23 @@ export const getDocumentByAccessToken = async ({ token }: GetDocumentByAccessTok
where: {
token,
},
include: {
select: {
document: {
include: {
documentData: true,
documentMeta: true,
select: {
title: true,
documentData: {
select: {
id: true,
type: true,
data: true,
initialData: true,
},
},
documentMeta: {
select: {
password: true,
},
},
},
},
},