diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 3b6bffff..efd97e9a 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -55,6 +55,7 @@ import CallAPI from "../interfaces/call-api"; import Extension from "../interfaces/extension"; import { Prefixe } from "../entities/Prefixe"; import { ProfileInsignia } from "../entities/ProfileInsignia"; +import { ProfileDisciplineHistory } from "../entities/ProfileDisciplineHistory"; @Route("api/v1/org/profile") @Tags("Profile") @@ -91,6 +92,7 @@ export class ProfileController extends Controller { private subDistrictRepo = AppDataSource.getRepository(SubDistrict); private profileInsigniaRepo = AppDataSource.getRepository(ProfileInsignia); private profileDisciplineRepo = AppDataSource.getRepository(ProfileDiscipline); + private disciplineHistoryRepository = AppDataSource.getRepository(ProfileDisciplineHistory); /** * report ประวัติแบบย่อ ข้าราชการ * @@ -1434,7 +1436,21 @@ export class ProfileController extends Controller { lastUpdateUserId: req.user.sub, lastUpdateFullName: req.user.name, }); - await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]); + //เพิ่มวินัย + const profileDiscipline: ProfileDiscipline = Object.assign(new ProfileDiscipline(), { + date: body.date, + profileId: body.profileId, + refCommandNo: body.refCommandNo, + createdUserId: req.user.sub, + createdFullName: req.user.name, + lastUpdateUserId: req.user.sub, + lastUpdateFullName: req.user.name, + }); + await Promise.all([ + this.profileRepo.save(profile), + this.salaryRepository.save(profileSalary), + this.profileDisciplineRepo.save(profileDiscipline) + ]); return new HttpSuccess(); }