ลบพัฒนา

This commit is contained in:
Kittapath 2024-07-19 12:05:38 +07:00
parent 16c3504f74
commit 8d62253a15

View file

@ -198,10 +198,12 @@ export class KpiUserDevelopmentController extends Controller {
async deleteKpiUserDevelopment(@Path() id: string) {
const delKpiUserDevelopment = await this.kpiUserDevelopmentRepository.findOne({
where: { id },
relations: ["developmentProjects"],
});
if (!delKpiUserDevelopment) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลพัฒนาตนเองนี้");
}
await this.developmentProjectRepository.remove(delKpiUserDevelopment.developmentProjects);
await this.kpiUserDevelopmentRepository.remove(delKpiUserDevelopment);
return new HttpSuccess();
}