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);
|
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 เชื่อมโยง
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue