delete
This commit is contained in:
parent
6499cb3da0
commit
17f110d345
1 changed files with 20 additions and 16 deletions
|
|
@ -124,7 +124,6 @@ export class kpiLinkController extends Controller {
|
|||
await this.positionRepository.remove(chkKpiLink.positions);
|
||||
Object.assign(chkKpiLink, {
|
||||
...requestBody,
|
||||
positions: [],
|
||||
kpiCapacitys: [],
|
||||
});
|
||||
chkKpiLink.kpiGroupId = requestBody.kpiGroupId,
|
||||
|
|
@ -194,22 +193,27 @@ export class kpiLinkController extends Controller {
|
|||
return new HttpSuccess(formattedResponse);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * API ลบเชื่อมโยง
|
||||
// * @param id
|
||||
// */
|
||||
// @Delete("{id}")
|
||||
// async deleteKpiLink(@Path() id: string) {
|
||||
// const kpiLink = await this.kpiLinkRepository.findOne({
|
||||
// where: { id: id },
|
||||
// });
|
||||
// if (!kpiLink) {
|
||||
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการเชื่อมโยง");
|
||||
// }
|
||||
/**
|
||||
* API ลบเชื่อมโยง
|
||||
* @param id
|
||||
*/
|
||||
@Delete("{id}")
|
||||
async deleteKpiLink(@Path() id: string) {
|
||||
const kpiLink = await this.kpiLinkRepository.findOne({
|
||||
where: { id: id },
|
||||
relations: ["kpiCapacitys"],
|
||||
});
|
||||
if (!kpiLink) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการเชื่อมโยง");
|
||||
}
|
||||
kpiLink.kpiCapacitys = [];
|
||||
await this.kpiLinkRepository.save(kpiLink);
|
||||
|
||||
// await this.kpiLinkRepository.remove(kpiLink);
|
||||
// return new HttpSuccess();
|
||||
// }
|
||||
await this.positionRepository.delete({ kpiLinkId: id });
|
||||
await this.kpiLinkRepository.delete({ id: id });
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* API list เชื่อมโยง
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue