From 87d9f39290faadefa3b303d7fb813de5bbc24572 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Mon, 24 Feb 2025 13:41:51 +0700 Subject: [PATCH] fix: wrongn condition --- src/controllers/08-credit-note-controller.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/controllers/08-credit-note-controller.ts b/src/controllers/08-credit-note-controller.ts index 3bd9427..9dfd915 100644 --- a/src/controllers/08-credit-note-controller.ts +++ b/src/controllers/08-credit-note-controller.ts @@ -418,17 +418,20 @@ export class CreditNoteController extends Controller { const requestWork = await prisma.requestWork.findMany({ where: { - OR: [{ creditNote: null }, { creditNoteId }], request: { - quotation: { - id: body.quotationId, - }, + quotation: { id: body.quotationId }, }, - stepStatus: { - some: { - workStatus: RequestWorkStatus.Canceled, + AND: [ + { + OR: [{ creditNote: null }, { creditNoteId }], }, - }, + { + OR: [ + { request: { requestDataStatus: RequestDataStatus.Canceled } }, + { stepStatus: { some: { workStatus: RequestWorkStatus.Canceled } } }, + ], + }, + ], id: { in: body.requestWorkId }, }, include: {