remove role add relation (#191)

Co-authored-by: mamoss <>
This commit is contained in:
Kittapath 2025-10-08 23:03:02 +07:00 committed by GitHub
parent e0e850b4c7
commit 6328de1a5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1519,7 +1519,10 @@ export class CommandController extends Controller {
await Promise.all(
response_.data.result.profiles.map(async (x: any) => {
const _profile = await this.profileRepository.findOneBy({ id: x.profileId });
const _profile = await this.profileRepository.findOne({
where: { id: x.profileId },
relations: ["roleKeycloaks"],
});
if (_profile) {
// console.log("1. บันทึกลงประวัติตำแหน่ง")
await this.profileSalaryRetire(x.profileId, type, signDate, _Date);
@ -1572,7 +1575,10 @@ export class CommandController extends Controller {
await Promise.all(
response_.data.result.profiles.map(async (x: any) => {
const _profileEmp = await this.profileEmployeeRepository.findOneBy({ id: x.profileId });
const _profileEmp = await this.profileEmployeeRepository.findOne({
where: { id: x.profileId },
relations: ["roleKeycloaks"],
});
if (_profileEmp) {
// บันทึกลงประวัติตำแหน่ง
await this.profileSalaryRetire(x.profileId, type, signDate, _Date);
@ -4694,6 +4700,7 @@ export class CommandController extends Controller {
if (item.isLeave != null) {
const _profile = await this.profileRepository.findOne({
where: { id: item.profileId },
relations: ["roleKeycloaks"],
});
if (!_profile) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
@ -4896,6 +4903,7 @@ export class CommandController extends Controller {
if (item.isLeave != null) {
const _profile = await this.profileEmployeeRepository.findOne({
where: { id: item.profileId },
relations: ["roleKeycloaks"],
});
if (!_profile) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
@ -5188,6 +5196,7 @@ export class CommandController extends Controller {
if (item.isLeave != null) {
const _profile = await this.profileEmployeeRepository.findOne({
where: { id: item.profileId },
relations: ["roleKeycloaks"],
});
if (!_profile) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
@ -5889,7 +5898,7 @@ export class CommandController extends Controller {
//กรณีลูกจ้างประจำมาสอบเป็นข้าราชการ ต้อง update สถานะโปรไฟล์เดิม
let profileEmployee: any = await this.profileEmployeeRepository.findOne({
where: { citizenId: item.bodyProfile.citizenId },
relations: ["profileInsignias"],
relations: ["profileInsignias", "roleKeycloaks"],
});
if (profileEmployee) {
const _order = await this.salaryRepo.findOne({