adding hrms api on login
This commit is contained in:
@ -34,6 +34,7 @@
|
||||
"reset_password_url": "https://bri-dev.shiblysolution.id/auth/reset-password/"
|
||||
},
|
||||
"service": {
|
||||
"notification": "http://127.0.0.1:4008/"
|
||||
"notification": "http://127.0.0.1:4008/",
|
||||
"hrms": "https://brilianapps.shiblysolution.id/hrms/"
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
"reset_password_url": "https://brilianapps.britimorleste.tl/ukln/auth/reset-password/"
|
||||
},
|
||||
"service": {
|
||||
"notification": "http://127.0.0.1:4008/"
|
||||
"notification": "http://127.0.0.1:4008/",
|
||||
"hrms": "http://127.0.0.1:80/"
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
"reset_password_url": "https://brilianapps.shiblysolution.id/ukln/auth/reset-password/"
|
||||
},
|
||||
"service": {
|
||||
"notification": "http://127.0.0.1:4008/"
|
||||
"notification": "http://127.0.0.1:4008/",
|
||||
"hrms": "http://127.0.0.1:80/"
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,6 +86,26 @@ export class AuthController {
|
||||
return ReturnHelper.errorResponse(res, 403, 403, Language.lang.failed_access + ', you don\'t have any roles in this application');
|
||||
} else {
|
||||
// const userRole = await userRoleRepository.findOneBy({ id: role_id })
|
||||
var hrms = {
|
||||
department_id: null,
|
||||
department_name: null,
|
||||
level_id: null,
|
||||
level_name: null
|
||||
}
|
||||
|
||||
if (user.nik) {
|
||||
const url = config.get("service.hrms") + "api/get-employee?nik=" + user.nik;
|
||||
const { data: dataHrms } = await axios.get(url);
|
||||
if (dataHrms && dataHrms.status && dataHrms.data.count == 1) {
|
||||
hrms = {
|
||||
department_id: dataHrms.data.list[0].idxdept,
|
||||
department_name: dataHrms.data.list[0].departement,
|
||||
level_id: dataHrms.data.list[0].idxlevel,
|
||||
level_name: dataHrms.data.list[0].level
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var privateKey = fs.readFileSync('src/helpers/key/private.key');
|
||||
|
||||
@ -107,7 +127,7 @@ export class AuthController {
|
||||
delete user.password;
|
||||
|
||||
const data = {
|
||||
user,
|
||||
user: { ...user, ...hrms },
|
||||
role_name: roles.name,
|
||||
roles_list: await AuthController.getListRole(roles.roles),
|
||||
token: {
|
||||
|
||||
Reference in New Issue
Block a user