ข้อมูลการประเมิน>>สมรรถนะ (บันทึกข้อมูลตำแหน่ง แต่ข้อมูลตำแหน่งไม่แสดง) #593

This commit is contained in:
AdisakKanthawilang 2024-09-13 15:23:19 +07:00
parent 32de413e1c
commit a83e1f111b

View file

@ -136,10 +136,23 @@ export class kpiLinkController extends Controller {
...requestBody,
kpiCapacitys: [],
});
const chkCapacity = await this.kpiCapacityRepository.find({
where: {
id: In(requestBody.kpiCapacityIds),
},
});
if (!chkCapacity) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการเชื่อมโยง");
}
chkKpiLink.kpiCapacitys = chkCapacity;
chkKpiLink.kpiGroupId = requestBody.kpiGroupId;
chkKpiLink.lastUpdateUserId = request.user.sub;
chkKpiLink.lastUpdateFullName = request.user.name;
chkKpiLink.lastUpdatedAt = new Date();
await this.kpiLinkRepository.save(chkKpiLink);
setLogDataDiff(request, { before, after: chkKpiLink });
if (requestBody.positions != null) {
await Promise.all(
@ -159,19 +172,6 @@ export class kpiLinkController extends Controller {
);
}
const chkCapacity = await this.kpiCapacityRepository.find({
where: {
id: In(requestBody.kpiCapacityIds),
},
});
if (!chkCapacity) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการเชื่อมโยง");
}
chkKpiLink.kpiCapacitys = chkCapacity;
await this.kpiLinkRepository.save(chkKpiLink, { data: request });
setLogDataDiff(request, { before, after: chkKpiLink });
return new HttpSuccess(chkKpiLink.id);
}