From b57a64fe0e07b0cc56972a5a3dfd3203d6148b91 Mon Sep 17 00:00:00 2001 From: harid Date: Thu, 12 Mar 2026 17:56:50 +0700 Subject: [PATCH] =?UTF-8?q?API=20=E0=B8=A5=E0=B8=9A=E0=B8=A3=E0=B8=B2?= =?UTF-8?q?=E0=B8=A2=E0=B8=8A=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=9C=E0=B8=B9?= =?UTF-8?q?=E0=B9=89=E0=B8=9C=E0=B9=88=E0=B8=B2=E0=B8=99=E0=B8=81=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3=E0=B8=AD=E0=B8=9A=E0=B8=A3=E0=B8=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/DevelopmentController.ts | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/controllers/DevelopmentController.ts b/src/controllers/DevelopmentController.ts index 2841e91..ee4caf4 100644 --- a/src/controllers/DevelopmentController.ts +++ b/src/controllers/DevelopmentController.ts @@ -1925,6 +1925,38 @@ export class DevelopmentController extends Controller { return new HttpSuccess({ data: development, total }); } + /** + * API ลบรายชื่อผู้ผ่านการอบรม + * + * @summary ลบรายชื่อผู้ผ่านการอบรม + * + * @param {string} id Id ผู้ผ่านการอบรม + */ + @Delete("delete/{id}") + async DeleteDevelopmentBy(@Path() id: string, @Request() request: RequestWithUser) { + await new permission().PermissionDelete(request, "SYS_DEV_PROJECT"); + const developmentHis = await this.developmentHistoryRepository.findOne({ + where: { id }, + }); + if (!developmentHis) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรายชื่อผู้ผ่านการอบรม"); + } + if (developmentHis.isProfile) { + if (developmentHis.isDone || developmentHis.isDoneIDP) { + await new CallAPI() + .PostData(request, "/org/profile/training/delete-byId", { + type: developmentHis.type, + profileId: developmentHis.profileId, + developmentId: developmentHis.developmentId, + }) + .then((x) => {}) + .catch((x) => {}); + } + } + await this.developmentHistoryRepository.delete({ id }); + return new HttpSuccess(); + } + /** * API ลบโครงการ/หลักสูตรการฝึกอบรม *