refactor: handle code error
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 4s

This commit is contained in:
Thanaphon Saengchan 2025-10-14 17:12:00 +07:00
parent 78669ed7ae
commit 16c4c64c89

View file

@ -265,7 +265,7 @@ export class TaskController extends Controller {
taskProduct?: { productId: string; discount?: number }[]; taskProduct?: { productId: string; discount?: number }[];
}, },
) { ) {
if (!body.taskList || !body.registeredBranchId) if (body.taskList.length < 1 || !body.registeredBranchId)
throw new HttpError( throw new HttpError(
HttpStatus.BAD_REQUEST, HttpStatus.BAD_REQUEST,
"Your created invalid task order", "Your created invalid task order",
@ -318,8 +318,8 @@ export class TaskController extends Controller {
}); });
if (updated.count !== taskList.length) { if (updated.count !== taskList.length) {
throw new httperror( throw new HttpError(
httpstatus.precondition_failed, HttpStatus.PRECONDITION_FAILED,
"all request work to issue task order must be in ready state.", "all request work to issue task order must be in ready state.",
"requestworkmustready", "requestworkmustready",
); );