fix bug capacity

This commit is contained in:
AdisakKanthawilang 2024-05-29 17:28:39 +07:00
parent 22f7e01ea8
commit c9c4d86f6a

View file

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