From a86035a003c69ad479750fcb5769fff24e8294f2 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 4 Dec 2024 14:25:56 +0700 Subject: [PATCH] feat: add ready to task filter --- src/controllers/06-request-list-controller.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/controllers/06-request-list-controller.ts b/src/controllers/06-request-list-controller.ts index 950b762..83ed235 100644 --- a/src/controllers/06-request-list-controller.ts +++ b/src/controllers/06-request-list-controller.ts @@ -183,9 +183,24 @@ export class RequestListController extends Controller { @Query() pageSize: number = 30, @Query() requestDataId?: string, @Query() workStatus?: RequestWorkStatus, + @Query() readyToTask?: boolean, ) { + let statusCondition: Prisma.RequestWorkWhereInput["stepStatus"] = {}; + + if (readyToTask) { + statusCondition = { + some: { + OR: [{ workStatus: RequestWorkStatus.Ready }, { workStatus: RequestWorkStatus.Redo }], + }, + }; + } else { + statusCondition = { + some: { workStatus }, + }; + } + const where = { - stepStatus: workStatus ? { some: { workStatus } } : undefined, + stepStatus: workStatus ? statusCondition : undefined, request: { id: requestDataId, quotation: {