From dc32f77a2c63be5b311d7ab2270b1a029c5039c3 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Tue, 17 Dec 2024 10:18:45 +0700 Subject: [PATCH] fix: do not throw error if send empty array --- src/controllers/05-quotation-controller.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/controllers/05-quotation-controller.ts b/src/controllers/05-quotation-controller.ts index 109847d..d4ffc31 100644 --- a/src/controllers/05-quotation-controller.ts +++ b/src/controllers/05-quotation-controller.ts @@ -869,7 +869,8 @@ export class QuotationActionController extends Controller { if (!quotation) throw relationError("Quotation"); if (ids.employee.length !== employee.length) throw relationError("Worker"); if (ids.productService.length !== productService.length) throw relationError("Product"); - if (quotation._count.worker >= (quotation.workerMax || 0)) { + if (quotation._count.worker + body.length >= (quotation.workerMax || 0)) { + if (body.length === 0) return; throw new HttpError( HttpStatus.PRECONDITION_FAILED, "Worker exceed current quotation max worker.",