diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..fdb2eaa --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +22.11.0 \ No newline at end of file diff --git a/src/Document/document.schema.ts b/src/Document/document.schema.ts index a8ea995..5ab8977 100644 --- a/src/Document/document.schema.ts +++ b/src/Document/document.schema.ts @@ -160,8 +160,10 @@ export class DocumentSchema extends PothosSchema { if (!ctx.http?.me?.id) throw new Error('User not found') if (!args.documentId) throw new Error('Document id not found') if (args.pageIndex === undefined || args.pageIndex === null) throw new Error('Page index not found') - const delta = await this.minio.getDocumentPage(args.documentId, args.pageIndex) - if (!delta) throw new Error('Delta not found') + let delta = null + try { + delta = await this.minio.getDocumentPage(args.documentId, args.pageIndex) + } catch (_error) {} const totalPage = await this.minio.countDocumentPages(args.documentId) return { documentId: args.documentId, @@ -311,10 +313,7 @@ export class DocumentSchema extends PothosSchema { }, }) if (!document) throw new Error('Document not found') - if ( - !document.isPublic && - !document.collaborators.some((c) => c.userId === ctx.http?.me?.id && c.writable) - ) + if (!document.isPublic && !document.collaborators.some((c) => c.userId === ctx.http?.me?.id && c.writable)) throw new Error('User is not owner or collaborator of document') return await this.prisma.document.update({ ...query,