From 1863d990c8d973b2fac02f2fb334e891e29745c2 Mon Sep 17 00:00:00 2001 From: Catalin Pit Date: Mon, 1 Sep 2025 13:56:21 +0300 Subject: [PATCH] chore: don't return more than necessary --- .../document/handle-document-ownership-on-deletion.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/lib/server-only/document/handle-document-ownership-on-deletion.ts b/packages/lib/server-only/document/handle-document-ownership-on-deletion.ts index c141dac2a..7371addcb 100644 --- a/packages/lib/server-only/document/handle-document-ownership-on-deletion.ts +++ b/packages/lib/server-only/document/handle-document-ownership-on-deletion.ts @@ -34,7 +34,11 @@ export const handleDocumentOwnershipOnDeletion = async ({ include: { ownedOrganisations: { include: { - teams: true, + teams: { + select: { + id: true, + }, + }, }, }, }, @@ -49,7 +53,7 @@ export const handleDocumentOwnershipOnDeletion = async ({ in: documentIds, }, status: { - not: DocumentStatus.DRAFT, + in: [DocumentStatus.PENDING, DocumentStatus.REJECTED, DocumentStatus.COMPLETED], }, }, data: { @@ -65,7 +69,7 @@ export const handleDocumentOwnershipOnDeletion = async ({ in: documentIds, }, status: { - not: DocumentStatus.DRAFT, + in: [DocumentStatus.PENDING, DocumentStatus.REJECTED, DocumentStatus.COMPLETED], }, }, data: {