รายการสมรรถนะ "สมรรถนะหลัก"

This commit is contained in:
Bright 2024-04-30 17:57:09 +07:00
parent b7c0075f5a
commit 0b49e363b5

View file

@ -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
*