migrate + fix issue #993
This commit is contained in:
parent
7a0ab2271d
commit
4011abe5ea
5 changed files with 142 additions and 43 deletions
|
|
@ -2579,9 +2579,16 @@ export class CommandController extends Controller {
|
|||
profile.posTypeId = _null;
|
||||
profile.posLevelId = _null;
|
||||
}
|
||||
const returnWork = await checkReturnCommandType(String(item.commandId));
|
||||
//คำสั่งบรรจุกลับเข้ารับราชการ หรือ ผู้ออกไปรับราชการทหารกลับเข้ารับราชการ solutionเดิม ให้ enable user เปลี่ยนเป็นสร้าง user ใหม่เลยเพราะยังไงตอนถูกพักก็ถูกลบ user
|
||||
if (returnWork && item.isGovernment) {
|
||||
if (item.isGovernment == true) {
|
||||
const returnWork = await checkReturnCommandType(String(item.commandId));
|
||||
if (returnWork) {
|
||||
profile.leaveReason = _null;
|
||||
profile.leaveCommandId = _null;
|
||||
profile.leaveCommandNo = _null;
|
||||
profile.leaveRemark = _null;
|
||||
profile.leaveDate = _null;
|
||||
profile.leaveType = _null;
|
||||
}
|
||||
let userKeycloakId;
|
||||
const checkUser = await getUserByUsername(profile.citizenId);
|
||||
//ถ้ายังไม่มี user keycloak ให้สร้างใหม่
|
||||
|
|
@ -3109,19 +3116,16 @@ export class CommandController extends Controller {
|
|||
_profile.lastUpdateUserId = req.user.sub;
|
||||
_profile.lastUpdateFullName = req.user.name;
|
||||
_profile.lastUpdatedAt = new Date();
|
||||
const exceptClear = await checkExceptCommandType(String(item.commandId));
|
||||
if (item.isLeave == true && !exceptClear) {
|
||||
if (item.isLeave == true) {
|
||||
await removeProfileInOrganize(_profile.id, "OFFICER");
|
||||
// }
|
||||
// //คำสั่งพักราชการ หรือ ให้ออกจากราชการไว้ก่อน solutionเดิม ให้ disable user ไว้แต่ยังไม่ลบ เปลี่ยนเป็นลบ user ออกเลย
|
||||
// else if (item.isLeave == true && exceptClear && _profile.keycloak != null) {
|
||||
// // const enableActive = await enableStatus(_profile.keycloak, false);
|
||||
// // if (!enableActive) throw new Error("Failed. Cannot change enable status.");
|
||||
const delUserKeycloak = await deleteUser(_profile.keycloak);
|
||||
if (delUserKeycloak) {
|
||||
_profile.keycloak = _null;
|
||||
_profile.roleKeycloaks = [];
|
||||
_profile.isActive = false;
|
||||
const exceptClear = await checkExceptCommandType(String(item.commandId));
|
||||
if(exceptClear.status){
|
||||
_profile.leaveReason = item.leaveReason ?? _null;
|
||||
_profile.leaveCommandId = item.commandId ?? _null;
|
||||
_profile.leaveCommandNo = item.refCommandNo ?? _null;
|
||||
_profile.leaveRemark = exceptClear.leaveRemark ?? _null;
|
||||
_profile.leaveDate = item.date ?? _null;
|
||||
_profile.leaveType = exceptClear.LeaveType ?? _null;
|
||||
}
|
||||
}
|
||||
const clearProfile = await checkCommandType(String(item.commandId));
|
||||
|
|
@ -3303,19 +3307,16 @@ export class CommandController extends Controller {
|
|||
_profile.lastUpdateUserId = req.user.sub;
|
||||
_profile.lastUpdateFullName = req.user.name;
|
||||
_profile.lastUpdatedAt = new Date();
|
||||
const exceptClear = await checkExceptCommandType(String(item.commandId));
|
||||
if (item.isLeave == true && !exceptClear) {
|
||||
if (item.isLeave == true) {
|
||||
await removeProfileInOrganize(_profile.id, "EMPLOYEE");
|
||||
// }
|
||||
// //คำสั่งพักราชการ หรือ ให้ออกจากราชการไว้ก่อน solutionเดิม ให้ disable user ไว้แต่ยังไม่ลบ เปลี่ยนเป็นลบ user ออกเลย
|
||||
// else if (item.isLeave == true && exceptClear && _profile.keycloak != null) {
|
||||
// // const enableActive = await enableStatus(_profile.keycloak, false);
|
||||
// // if (!enableActive) throw new Error("Failed. Cannot change enable status.");
|
||||
const delUserKeycloak = await deleteUser(_profile.keycloak);
|
||||
if (delUserKeycloak) {
|
||||
_profile.keycloak = _null;
|
||||
_profile.roleKeycloaks = [];
|
||||
_profile.isActive = false;
|
||||
const exceptClear = await checkExceptCommandType(String(item.commandId));
|
||||
if(exceptClear.status) {
|
||||
_profile.leaveReason = item.leaveReason ?? _null;
|
||||
_profile.leaveCommandId = item.commandId ?? _null;
|
||||
_profile.leaveCommandNo = item.refCommandNo ?? _null;
|
||||
_profile.leaveRemark = exceptClear.leaveRemark ?? _null;
|
||||
_profile.leaveDate = item.date ?? _null;
|
||||
_profile.leaveType = exceptClear.LeaveType ?? _null;
|
||||
}
|
||||
}
|
||||
const clearProfile = await checkCommandType(String(item.commandId));
|
||||
|
|
@ -3533,19 +3534,16 @@ export class CommandController extends Controller {
|
|||
_profile.lastUpdateUserId = req.user.sub;
|
||||
_profile.lastUpdateFullName = req.user.name;
|
||||
_profile.lastUpdatedAt = new Date();
|
||||
const exceptClear = await checkExceptCommandType(String(item.commandId));
|
||||
if (item.isLeave == true && !exceptClear) {
|
||||
if (item.isLeave == true) {
|
||||
await removeProfileInOrganize(_profile.id, "EMPLOYEE");
|
||||
// }
|
||||
// //คำสั่งพักราชการ หรือ ให้ออกจากราชการไว้ก่อน solutionเดิม ให้ disable user ไว้แต่ยังไม่ลบ เปลี่ยนเป็นลบ user ออกเลย
|
||||
// else if (item.isLeave == true && exceptClear && _profile.keycloak != null) {
|
||||
// // const enableActive = await enableStatus(_profile.keycloak, false);
|
||||
// // if (!enableActive) throw new Error("Failed. Cannot change enable status.");
|
||||
const delUserKeycloak = await deleteUser(_profile.keycloak);
|
||||
if (delUserKeycloak) {
|
||||
_profile.keycloak = _null;
|
||||
_profile.roleKeycloaks = [];
|
||||
_profile.isActive = false;
|
||||
const exceptClear = await checkExceptCommandType(String(item.commandId));
|
||||
if(exceptClear.status) {
|
||||
_profile.leaveReason = item.leaveReason ?? _null;
|
||||
_profile.leaveCommandId = item.commandId ?? _null;
|
||||
_profile.leaveCommandNo = item.refCommandNo ?? _null;
|
||||
_profile.leaveRemark = exceptClear.leaveRemark ?? _null;
|
||||
_profile.leaveDate = item.date ?? _null;
|
||||
_profile.leaveType = exceptClear.LeaveType ?? _null;
|
||||
}
|
||||
}
|
||||
const clearProfile = await checkCommandType(String(item.commandId));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue