From 0b49e363b5d5932005bed6c5c3501b9a20ae4462 Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 30 Apr 2024 17:57:09 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=81=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3=E0=B8=AA=E0=B8=A1=E0=B8=A3=E0=B8=A3=E0=B8=96=E0=B8=99?= =?UTF-8?q?=E0=B8=B0=20"=E0=B8=AA=E0=B8=A1=E0=B8=A3=E0=B8=A3=E0=B8=96?= =?UTF-8?q?=E0=B8=99=E0=B8=B0=E0=B8=AB=E0=B8=A5=E0=B8=B1=E0=B8=81"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/KpiCapacityController.ts | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/controllers/KpiCapacityController.ts b/src/controllers/KpiCapacityController.ts index 02bab63..0db5792 100644 --- a/src/controllers/KpiCapacityController.ts +++ b/src/controllers/KpiCapacityController.ts @@ -176,6 +176,33 @@ export class kpiCapacityController extends Controller { return new HttpSuccess(kpiCapacity.id); } + /** + * API รายละเอียดรายการสมรรถนะ "สมรรถนะหลัก" + * + * @summary รายละเอียดดรายการสมรรถนะ "สมรรถนะหลัก" + * + */ + @Get("head") + async GetKpiCapacityTypeHEAD() { + const kpiCapacity = await this.kpiCapacityRepository.find({ + where: { + type: In(["HEAD"]), + kpiCapacityDetails: { level: "1" } + }, + select: ["id", "name"], + relations: ["kpiCapacityDetails"], + }); + + const mapData = kpiCapacity.map((x) => ({ + id: x.id, + name: x.name, + level: x.kpiCapacityDetails.length > 0 ? x.kpiCapacityDetails[0].level : null, + description: x.kpiCapacityDetails.length > 0 ? x.kpiCapacityDetails[0].description : null, + })); + + return new HttpSuccess(mapData); + } + /** * API รายละเอียดรายการสมรรถนะ *