This commit is contained in:
parent
91887ec63d
commit
060ac81532
4 changed files with 201 additions and 123 deletions
|
|
@ -101,6 +101,7 @@ import {
|
|||
} from "../services/PositionService";
|
||||
import { PostRetireToExprofile } from "./ExRetirementController";
|
||||
import { LeaveType } from "../entities/LeaveType";
|
||||
import { KeycloakAttributeService } from "../services/KeycloakAttributeService";
|
||||
@Route("api/v1/org/command")
|
||||
@Tags("Command")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -157,6 +158,8 @@ export class CommandController extends Controller {
|
|||
private genderRepo = AppDataSource.getRepository(Gender);
|
||||
private avatarRepository = AppDataSource.getRepository(ProfileAvatar);
|
||||
private leaveType = AppDataSource.getRepository(LeaveType);
|
||||
private keycloakAttributeService = new KeycloakAttributeService();
|
||||
|
||||
/**
|
||||
* API list รายการคำสั่ง
|
||||
*
|
||||
|
|
@ -4253,6 +4256,14 @@ export class CommandController extends Controller {
|
|||
profile.isActive = true;
|
||||
}
|
||||
await this.profileRepository.save(profile);
|
||||
|
||||
if (profile.id) {
|
||||
await this.keycloakAttributeService.clearOrgDnaAttributes(
|
||||
[profile.id],
|
||||
"PROFILE",
|
||||
);
|
||||
}
|
||||
|
||||
// update user attribute in keycloak
|
||||
await updateUserAttributes(profile.keycloak ?? "", {
|
||||
profileId: [profile.id],
|
||||
|
|
@ -4499,6 +4510,14 @@ export class CommandController extends Controller {
|
|||
// profile.posLevelId = _null;
|
||||
}
|
||||
await this.profileEmployeeRepository.save(profile);
|
||||
|
||||
if (profile.id) {
|
||||
await this.keycloakAttributeService.clearOrgDnaAttributes(
|
||||
[profile.id],
|
||||
"PROFILE_EMPLOYEE",
|
||||
);
|
||||
}
|
||||
|
||||
// Task #2190
|
||||
if (code && ["C-PM-23", "C-PM-43"].includes(code)) {
|
||||
let organizeName = "";
|
||||
|
|
@ -4714,6 +4733,13 @@ export class CommandController extends Controller {
|
|||
profile.amount = item.amount ?? _null;
|
||||
profile.amountSpecial = item.amountSpecial ?? _null;
|
||||
await this.profileRepository.save(profile, { data: req });
|
||||
|
||||
if (profile.id) {
|
||||
await this.keycloakAttributeService.clearOrgDnaAttributes(
|
||||
[profile.id],
|
||||
"PROFILE",
|
||||
);
|
||||
}
|
||||
}
|
||||
Object.assign(data, { ...item, ...meta });
|
||||
const history = new ProfileSalaryHistory();
|
||||
|
|
@ -5198,6 +5224,12 @@ export class CommandController extends Controller {
|
|||
// _profile.posLevelId = _null;
|
||||
}
|
||||
await this.profileRepository.save(_profile);
|
||||
if (_profile.id) {
|
||||
await this.keycloakAttributeService.clearOrgDnaAttributes(
|
||||
[_profile.id],
|
||||
"PROFILE",
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// ลูกจ้าง
|
||||
|
|
@ -5375,6 +5407,12 @@ export class CommandController extends Controller {
|
|||
// _profile.posLevelId = _null;
|
||||
}
|
||||
await this.profileEmployeeRepository.save(_profile);
|
||||
if (_profile.id) {
|
||||
await this.keycloakAttributeService.clearOrgDnaAttributes(
|
||||
[_profile.id],
|
||||
"PROFILE_EMPLOYEE",
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Task #2190
|
||||
|
|
@ -5706,6 +5744,13 @@ export class CommandController extends Controller {
|
|||
// _profile.posLevelId = _null;
|
||||
}
|
||||
await this.profileEmployeeRepository.save(_profile);
|
||||
|
||||
if (_profile.id) {
|
||||
await this.keycloakAttributeService.clearOrgDnaAttributes(
|
||||
[_profile.id],
|
||||
"PROFILE_EMPLOYEE",
|
||||
);
|
||||
}
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
|
@ -6139,6 +6184,14 @@ export class CommandController extends Controller {
|
|||
this.profileRepository.save(_profile),
|
||||
this.salaryRepo.save(profileSalary),
|
||||
]);
|
||||
|
||||
if (profile.id) {
|
||||
await this.keycloakAttributeService.clearOrgDnaAttributes(
|
||||
[profile.id],
|
||||
"PROFILE",
|
||||
);
|
||||
}
|
||||
|
||||
const history = new ProfileSalaryHistory();
|
||||
Object.assign(history, { ...profileSalary, id: undefined });
|
||||
history.profileSalaryId = profileSalary.id;
|
||||
|
|
@ -6170,7 +6223,6 @@ export class CommandController extends Controller {
|
|||
);
|
||||
}),
|
||||
);
|
||||
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import {
|
|||
CreatePosMasterHistoryOfficer,
|
||||
} from "../services/PositionService";
|
||||
import { PosMasterEmployeeHistory } from "../entities/PosMasterEmployeeHistory";
|
||||
import { KeycloakAttributeService } from "../services/KeycloakAttributeService";
|
||||
@Route("api/v1/org/employee/pos")
|
||||
@Tags("Employee")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -65,6 +66,7 @@ export class EmployeePositionController extends Controller {
|
|||
private child3Repository = AppDataSource.getRepository(OrgChild3);
|
||||
private child4Repository = AppDataSource.getRepository(OrgChild4);
|
||||
private authRoleRepo = AppDataSource.getRepository(AuthRole);
|
||||
private keycloakAttributeService = new KeycloakAttributeService();
|
||||
|
||||
/**
|
||||
* API เพิ่มตำแหน่งลูกจ้างประจำ
|
||||
|
|
@ -2435,6 +2437,12 @@ export class EmployeePositionController extends Controller {
|
|||
// await this.profileRepository.save(profile);
|
||||
// }
|
||||
// }
|
||||
if (dataMaster.current_holderId) {
|
||||
await this.keycloakAttributeService.clearOrgDnaAttributes(
|
||||
[dataMaster.current_holderId],
|
||||
"PROFILE_EMPLOYEE",
|
||||
);
|
||||
}
|
||||
|
||||
await this.employeePosMasterRepository.update(id, {
|
||||
isSit: false,
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import permission from "../interfaces/permission";
|
|||
import { setLogDataDiff } from "../interfaces/utils";
|
||||
import { CreatePosMasterHistoryEmployeeTemp } from "../services/PositionService";
|
||||
import { PosMasterEmployeeTempHistory } from "../entities/PosMasterEmployeeTempHistory";
|
||||
import { KeycloakAttributeService } from "../services/KeycloakAttributeService";
|
||||
@Route("api/v1/org/employee-temp/pos")
|
||||
@Tags("Employee")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -65,6 +66,7 @@ export class EmployeeTempPositionController extends Controller {
|
|||
private child3Repository = AppDataSource.getRepository(OrgChild3);
|
||||
private child4Repository = AppDataSource.getRepository(OrgChild4);
|
||||
private authRoleRepo = AppDataSource.getRepository(AuthRole);
|
||||
private keycloakAttributeService = new KeycloakAttributeService();
|
||||
|
||||
/**
|
||||
* API เพิ่มตำแหน่งลูกจ้างประจำ
|
||||
|
|
@ -2141,6 +2143,13 @@ export class EmployeeTempPositionController extends Controller {
|
|||
// }
|
||||
// }
|
||||
|
||||
if (dataMaster.current_holderId) {
|
||||
await this.keycloakAttributeService.clearOrgDnaAttributes(
|
||||
[dataMaster.current_holderId],
|
||||
"PROFILE_EMPLOYEE",
|
||||
);
|
||||
}
|
||||
|
||||
await this.employeeTempPosMasterRepository.update(id, {
|
||||
isSit: false,
|
||||
next_holderId: null,
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import { Assign } from "../entities/Assign";
|
|||
import { ProfileEmployee } from "../entities/ProfileEmployee";
|
||||
import { PosMasterHistory } from "../entities/PosMasterHistory";
|
||||
import { CreatePosMasterHistoryOfficer } from "../services/PositionService";
|
||||
import { KeycloakAttributeService } from "../services/KeycloakAttributeService";
|
||||
@Route("api/v1/org/pos")
|
||||
@Tags("Position")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -73,6 +74,7 @@ export class PositionController extends Controller {
|
|||
private authRoleRepo = AppDataSource.getRepository(AuthRole);
|
||||
private posMasterAssignRepo = AppDataSource.getRepository(PosMasterAssign);
|
||||
private assignRepo = AppDataSource.getRepository(Assign);
|
||||
private keycloakAttributeService = new KeycloakAttributeService();
|
||||
|
||||
/**
|
||||
* API เพิ่มตำแหน่ง
|
||||
|
|
@ -3868,6 +3870,13 @@ export class PositionController extends Controller {
|
|||
await CreatePosMasterHistoryOfficer(dataMaster.id, request, "DELETE");
|
||||
}
|
||||
|
||||
if (dataMaster.current_holderId) {
|
||||
await this.keycloakAttributeService.clearOrgDnaAttributes(
|
||||
[dataMaster.current_holderId],
|
||||
"PROFILE",
|
||||
);
|
||||
}
|
||||
|
||||
let _profileId: string = "";
|
||||
if (dataMaster?.current_holderId) {
|
||||
_profileId = dataMaster?.current_holderId;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue