From 401584c8afdf2ce7b186734315535d55a5ac3af2 Mon Sep 17 00:00:00 2001 From: Bright Date: Wed, 19 Mar 2025 17:59:14 +0700 Subject: [PATCH] =?UTF-8?q?fix=20=E0=B8=A3=E0=B8=B0=E0=B8=9A=E0=B8=9A?= =?UTF-8?q?=E0=B8=82=E0=B9=89=E0=B8=AD=E0=B8=A1=E0=B8=B9=E0=B8=A5=E0=B8=81?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B9=80=E0=B8=A1?= =?UTF-8?q?=E0=B8=B4=E0=B8=99>>=E0=B8=95=E0=B8=B1=E0=B8=A7=E0=B8=8A?= =?UTF-8?q?=E0=B8=B5=E0=B9=89=E0=B8=A7=E0=B8=B1=E0=B8=94=20(=E0=B8=95?= =?UTF-8?q?=E0=B8=B2=E0=B8=A1=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99?= =?UTF-8?q?=E0=B9=88=E0=B8=87)=20=E0=B8=A3=E0=B8=B0=E0=B8=9A=E0=B8=9A?= =?UTF-8?q?=E0=B8=9A=E0=B9=81=E0=B8=88=E0=B9=89=E0=B8=87=E0=B9=84=E0=B8=A1?= =?UTF-8?q?=E0=B9=88=E0=B8=9E=E0=B8=9A=E0=B8=95=E0=B8=B1=E0=B8=A7=E0=B8=8A?= =?UTF-8?q?=E0=B8=B5=E0=B9=89=E0=B8=A7=E0=B8=B1=E0=B8=94=20#1253?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/KpiRoleController.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/controllers/KpiRoleController.ts b/src/controllers/KpiRoleController.ts index 7908ec8..5191671 100644 --- a/src/controllers/KpiRoleController.ts +++ b/src/controllers/KpiRoleController.ts @@ -231,7 +231,9 @@ export class kpiRoleController extends Controller { const kpiPeriod = await this.kpiPeriodRepository .createQueryBuilder("kpiPeriod") .where("kpiPeriod.year = :year", { year: requestBody.year }) - .andWhere("kpiPeriod.durationKPI = :durationKPI", { durationKPI: requestBody.period }) + .andWhere(requestBody.period ? "kpiPeriod.durationKPI = :durationKPI" : "1=1", { + durationKPI: requestBody.period, + }) .getOne(); if (!kpiPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตัวชี้วัดตามตำแหน่งนี้");