From c9c4d86f6ac0fec1735882fd705e9bf6c21aa64b Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Wed, 29 May 2024 17:28:39 +0700 Subject: [PATCH] fix bug capacity --- src/controllers/KpiCapacityController.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/controllers/KpiCapacityController.ts b/src/controllers/KpiCapacityController.ts index d6629f1..2cf41fc 100644 --- a/src/controllers/KpiCapacityController.ts +++ b/src/controllers/KpiCapacityController.ts @@ -216,12 +216,16 @@ export class kpiCapacityController extends Controller { @Query("positionName") positionName: string ) { - const position = await this.positionRepository.findOne({ + let position = await this.positionRepository.findOne({ where: { name: Like(`%${positionName}%`) }, relations: ["kpiLink.kpiCapacitys"] }) - if(position == null){ - throw new HttpError(HttpStatusCode.NOT_FOUND, `ไม่พบข้อมูลตำแหน่งนี้: ${positionName}`); + + if (position == null) { + position = await this.positionRepository.findOne({ + where: { name: "นักจัดการงานทั่วไป" }, + relations: ["kpiLink.kpiCapacitys"] + }) } let positionLinkId: any