Merge branch 'develop' into develop-Bright
This commit is contained in:
commit
b4b49b7378
2 changed files with 14 additions and 10 deletions
|
|
@ -1439,7 +1439,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
||||||
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
||||||
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||||
.where("current_holders.orgRevisionId = :orgRevisionId", {orgRevisionId: findRevision.id})
|
.where("current_holders.orgRevisionId = :orgRevisionId", { orgRevisionId: findRevision.id })
|
||||||
.andWhere(
|
.andWhere(
|
||||||
_data.root != undefined && _data.root != null
|
_data.root != undefined && _data.root != null
|
||||||
? _data.root[0] != null
|
? _data.root[0] != null
|
||||||
|
|
@ -3759,6 +3759,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
where: {
|
where: {
|
||||||
keycloak: IsNull(),
|
keycloak: IsNull(),
|
||||||
citizenId: Like(`%${body.keyword}%`),
|
citizenId: Like(`%${body.keyword}%`),
|
||||||
|
employeeClass: "PREM",
|
||||||
},
|
},
|
||||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
||||||
skip,
|
skip,
|
||||||
|
|
@ -3771,6 +3772,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
where: {
|
where: {
|
||||||
keycloak: IsNull(),
|
keycloak: IsNull(),
|
||||||
firstName: Like(`%${body.keyword}%`),
|
firstName: Like(`%${body.keyword}%`),
|
||||||
|
employeeClass: "PREM",
|
||||||
},
|
},
|
||||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
||||||
skip,
|
skip,
|
||||||
|
|
@ -3783,6 +3785,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
where: {
|
where: {
|
||||||
keycloak: IsNull(),
|
keycloak: IsNull(),
|
||||||
lastName: Like(`%${body.keyword}%`),
|
lastName: Like(`%${body.keyword}%`),
|
||||||
|
employeeClass: "PREM",
|
||||||
},
|
},
|
||||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
||||||
skip,
|
skip,
|
||||||
|
|
@ -3794,6 +3797,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
[findProfile, total] = await this.profileRepo.findAndCount({
|
[findProfile, total] = await this.profileRepo.findAndCount({
|
||||||
where: {
|
where: {
|
||||||
keycloak: IsNull(),
|
keycloak: IsNull(),
|
||||||
|
employeeClass: "PREM",
|
||||||
},
|
},
|
||||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
||||||
skip,
|
skip,
|
||||||
|
|
|
||||||
|
|
@ -212,6 +212,7 @@ export class KeycloakController extends Controller {
|
||||||
const profileEmp = await this.profileEmpRepo.findOne({
|
const profileEmp = await this.profileEmpRepo.findOne({
|
||||||
where: {
|
where: {
|
||||||
keycloak: userId,
|
keycloak: userId,
|
||||||
|
employeeClass: "PREM",
|
||||||
},
|
},
|
||||||
relations: ["roleKeycloaks"],
|
relations: ["roleKeycloaks"],
|
||||||
});
|
});
|
||||||
|
|
@ -245,7 +246,6 @@ export class KeycloakController extends Controller {
|
||||||
|
|
||||||
@Post("{userId}/role")
|
@Post("{userId}/role")
|
||||||
async addRole(@Path() userId: string, @Body() body: { role: string[] }) {
|
async addRole(@Path() userId: string, @Body() body: { role: string[] }) {
|
||||||
|
|
||||||
const list = await getRoles();
|
const list = await getRoles();
|
||||||
if (!Array.isArray(list)) throw new Error("Failed. Cannot get role(s) data from the server.");
|
if (!Array.isArray(list)) throw new Error("Failed. Cannot get role(s) data from the server.");
|
||||||
const result = await addUserRoles(
|
const result = await addUserRoles(
|
||||||
|
|
@ -266,18 +266,17 @@ export class KeycloakController extends Controller {
|
||||||
});
|
});
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
const profileEmp = await this.profileEmpRepo.findOne({
|
const profileEmp = await this.profileEmpRepo.findOne({
|
||||||
where: { keycloak: userId },
|
where: { keycloak: userId, employeeClass: "PREM" },
|
||||||
relations: ["roleKeycloaks"],
|
relations: ["roleKeycloaks"],
|
||||||
});
|
});
|
||||||
// if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
// if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
if(profileEmp) {
|
if (profileEmp) {
|
||||||
profileEmp.roleKeycloaks = Array.from(
|
profileEmp.roleKeycloaks = Array.from(
|
||||||
new Set([...profileEmp.roleKeycloaks, ...roleKeycloak]),
|
new Set([...profileEmp.roleKeycloaks, ...roleKeycloak]),
|
||||||
);
|
);
|
||||||
this.profileEmpRepo.save(profileEmp);
|
this.profileEmpRepo.save(profileEmp);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
profile.roleKeycloaks = Array.from(new Set([...profile.roleKeycloaks, ...roleKeycloak]));
|
profile.roleKeycloaks = Array.from(new Set([...profile.roleKeycloaks, ...roleKeycloak]));
|
||||||
this.profileRepo.save(profile);
|
this.profileRepo.save(profile);
|
||||||
}
|
}
|
||||||
|
|
@ -293,7 +292,7 @@ export class KeycloakController extends Controller {
|
||||||
});
|
});
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
const profileEmp = await this.profileEmpRepo.findOne({
|
const profileEmp = await this.profileEmpRepo.findOne({
|
||||||
where: { keycloak: userId },
|
where: { keycloak: userId, employeeClass: "PREM" },
|
||||||
relations: ["roleKeycloaks"],
|
relations: ["roleKeycloaks"],
|
||||||
});
|
});
|
||||||
if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
|
@ -532,6 +531,7 @@ export class KeycloakController extends Controller {
|
||||||
.leftJoinAndSelect("profileEmployee.current_holders", "current_holders")
|
.leftJoinAndSelect("profileEmployee.current_holders", "current_holders")
|
||||||
.where("profileEmployee.keycloak IS NOT NULL AND profileEmployee.keycloak != ''")
|
.where("profileEmployee.keycloak IS NOT NULL AND profileEmployee.keycloak != ''")
|
||||||
.andWhere(condition)
|
.andWhere(condition)
|
||||||
|
.andWhere({ employeeClass: "PREM" })
|
||||||
.andWhere(
|
.andWhere(
|
||||||
new Brackets((qb) => {
|
new Brackets((qb) => {
|
||||||
qb.orWhere(
|
qb.orWhere(
|
||||||
|
|
@ -647,7 +647,7 @@ export class KeycloakController extends Controller {
|
||||||
});
|
});
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
const profileEmp = await this.profileEmpRepo.findOne({
|
const profileEmp = await this.profileEmpRepo.findOne({
|
||||||
where: { keycloak: id },
|
where: { keycloak: id, employeeClass: "PREM" },
|
||||||
relations: ["roleKeycloaks"],
|
relations: ["roleKeycloaks"],
|
||||||
});
|
});
|
||||||
if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
|
@ -667,7 +667,7 @@ export class KeycloakController extends Controller {
|
||||||
});
|
});
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
const profileEmp = await this.profileEmpRepo.findOne({
|
const profileEmp = await this.profileEmpRepo.findOne({
|
||||||
where: { keycloak: userId },
|
where: { keycloak: userId, employeeClass: "PREM" },
|
||||||
});
|
});
|
||||||
if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!profileEmp) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
profileEmp.isActive = status;
|
profileEmp.isActive = status;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue