From 16c4c64c899b3666cb15f5d20b05606c31075732 Mon Sep 17 00:00:00 2001 From: net Date: Tue, 14 Oct 2025 17:12:00 +0700 Subject: [PATCH] refactor: handle code error --- src/controllers/07-task-controller.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/controllers/07-task-controller.ts b/src/controllers/07-task-controller.ts index cf7b402..02def1e 100644 --- a/src/controllers/07-task-controller.ts +++ b/src/controllers/07-task-controller.ts @@ -265,7 +265,7 @@ export class TaskController extends Controller { taskProduct?: { productId: string; discount?: number }[]; }, ) { - if (!body.taskList || !body.registeredBranchId) + if (body.taskList.length < 1 || !body.registeredBranchId) throw new HttpError( HttpStatus.BAD_REQUEST, "Your created invalid task order", @@ -318,8 +318,8 @@ export class TaskController extends Controller { }); if (updated.count !== taskList.length) { - throw new httperror( - httpstatus.precondition_failed, + throw new HttpError( + HttpStatus.PRECONDITION_FAILED, "all request work to issue task order must be in ready state.", "requestworkmustready", );