ออกคำสั่งไล่ออก (เพิ่มวินัย)

This commit is contained in:
Bright 2024-07-04 17:59:31 +07:00
parent 2e28488564
commit ac42957b91

View file

@ -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();
}