From 25e5f19142a95339f9b51d073a067da7d4b9c9ef Mon Sep 17 00:00:00 2001 From: Bright Date: Mon, 30 Sep 2024 16:16:23 +0700 Subject: [PATCH] =?UTF-8?q?fix=20#649=20=E0=B8=AA=E0=B8=A1=E0=B8=A3?= =?UTF-8?q?=E0=B8=A3=E0=B8=96=E0=B8=99=E0=B8=B0=E0=B8=9B=E0=B8=A3=E0=B8=B0?= =?UTF-8?q?=E0=B8=88=E0=B8=B3=E0=B8=81=E0=B8=A5=E0=B8=B8=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=E0=B8=87=E0=B8=B2=E0=B8=99=E0=B9=84=E0=B8=A1=E0=B9=88=E0=B9=81?= =?UTF-8?q?=E0=B8=AA=E0=B8=94=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/KpiCapacityController.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/controllers/KpiCapacityController.ts b/src/controllers/KpiCapacityController.ts index da06586..60e054d 100644 --- a/src/controllers/KpiCapacityController.ts +++ b/src/controllers/KpiCapacityController.ts @@ -22,7 +22,7 @@ import HttpStatusCode from "../interfaces/http-status"; import { KpiCapacity } from "../entities/kpiCapacity"; import { Position } from "../entities/position"; import { KpiCapacityDetail } from "../entities/kpiCapacityDetail"; -import { Like, In } from "typeorm"; +import { Like, In, Not, IsNull } from "typeorm"; import permission from "../interfaces/permission"; import { RequestWithUser } from "../middlewares/user"; import { setLogDataDiff } from "../interfaces/utils"; @@ -230,13 +230,19 @@ export class kpiCapacityController extends Controller { @Get("group") async GetKpiCapacityTypeGROUP(@Query("positionName") positionName: string) { let position = await this.positionRepository.findOne({ - where: { name: Like(`${positionName}`) }, + where: { + name: Like(`${positionName}`), + kpiLink: Not(IsNull()) || Not("") + }, relations: ["kpiLink", "kpiLink.kpiCapacitys"], }); if (position == null) { position = await this.positionRepository.findOne({ - where: { name: "นักจัดการงานทั่วไป" }, + where: { + name: "นักจัดการงานทั่วไป", + kpiLink: Not(IsNull()) || Not("") + }, relations: ["kpiLink", "kpiLink.kpiCapacitys"], }); }