From bada98d12d055a7a1e0c6582818cedd34457ced1 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Tue, 23 Jul 2024 11:53:43 +0700 Subject: [PATCH] feat: exclude some work from service --- src/controllers/quotation-controller.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/controllers/quotation-controller.ts b/src/controllers/quotation-controller.ts index 68d5dbb..02e4347 100644 --- a/src/controllers/quotation-controller.ts +++ b/src/controllers/quotation-controller.ts @@ -67,6 +67,7 @@ type QuotationCreate = { work: { id: string; // Name field will come from original data + excluded?: boolean; product: { id: string; amount: number; @@ -335,6 +336,8 @@ export class QuotationController extends Controller { detail: currentService.detail, attributes: currentService.attributes as Prisma.JsonObject, work: a.work.flatMap((c) => { + if (c.excluded) return []; + const currentWork = currentService.work.find((d) => d.id === c.id); if (!currentWork) return []; // should not possible