This commit is contained in:
AdisakKanthawilang 2024-04-19 17:13:45 +07:00
parent 6499cb3da0
commit 17f110d345

View file

@ -124,7 +124,6 @@ export class kpiLinkController extends Controller {
await this.positionRepository.remove(chkKpiLink.positions); await this.positionRepository.remove(chkKpiLink.positions);
Object.assign(chkKpiLink, { Object.assign(chkKpiLink, {
...requestBody, ...requestBody,
positions: [],
kpiCapacitys: [], kpiCapacitys: [],
}); });
chkKpiLink.kpiGroupId = requestBody.kpiGroupId, chkKpiLink.kpiGroupId = requestBody.kpiGroupId,
@ -194,22 +193,27 @@ export class kpiLinkController extends Controller {
return new HttpSuccess(formattedResponse); return new HttpSuccess(formattedResponse);
} }
// /** /**
// * API ลบเชื่อมโยง * API
// * @param id * @param id
// */ */
// @Delete("{id}") @Delete("{id}")
// async deleteKpiLink(@Path() id: string) { async deleteKpiLink(@Path() id: string) {
// const kpiLink = await this.kpiLinkRepository.findOne({ const kpiLink = await this.kpiLinkRepository.findOne({
// where: { id: id }, where: { id: id },
// }); relations: ["kpiCapacitys"],
// if (!kpiLink) { });
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการเชื่อมโยง"); if (!kpiLink) {
// } throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการเชื่อมโยง");
}
kpiLink.kpiCapacitys = [];
await this.kpiLinkRepository.save(kpiLink);
// await this.kpiLinkRepository.remove(kpiLink); await this.positionRepository.delete({ kpiLinkId: id });
// return new HttpSuccess(); await this.kpiLinkRepository.delete({ id: id });
// }
return new HttpSuccess();
}
/** /**
* API list * API list