diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index b87ee041..209e0633 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -1122,13 +1122,13 @@ export class PositionController extends Controller { where: { posMasterId: posMaster.id }, relations: ["posType", "posLevel", "posExecutive"], // order: { lastUpdatedAt: "ASC" }, - order: { + order: { posType: { - posTypeRank: "ASC" + posTypeRank: "ASC", }, posLevel: { - posLevelRank: "ASC" - } + posLevelRank: "ASC", + }, }, }); const formattedData = { @@ -1423,7 +1423,7 @@ export class PositionController extends Controller { .andWhere(checkChildConditions) .andWhere(typeCondition) .andWhere(revisionCondition); - }) + }), ) .orWhere( new Brackets((qb) => { @@ -1438,13 +1438,13 @@ export class PositionController extends Controller { .andWhere(checkChildConditions) .andWhere(typeCondition) .andWhere(revisionCondition); - }) + }), ) .orderBy("posMaster.posMasterOrder", "ASC") .skip((body.page - 1) * body.pageSize) .take(body.pageSize) .getManyAndCount(); - + //แก้ค้นหา let _position: any[] = []; let x: any = null; @@ -2005,6 +2005,7 @@ export class PositionController extends Controller { profilePostype: type == null || type.posTypeName == null ? null : type.posTypeName, profilePoslevel: level == null || level.posLevelName == null ? null : level.posLevelName, authRoleId: posMaster.authRoleId, + isCondition: posMaster.isCondition, authRoleName: authRoleName == null || authRoleName.roleName == null ? null : authRoleName.roleName, positions: positions.map((position: any) => ({ diff --git a/src/controllers/UserController.ts b/src/controllers/UserController.ts index 1b9a7435..54aa5f0b 100644 --- a/src/controllers/UserController.ts +++ b/src/controllers/UserController.ts @@ -435,7 +435,7 @@ export class KeycloakController extends Controller { ) { let condition: any = {}; - if (req.user.role.includes("ADMIN")) { + if (req.user.role.includes("ADMIN") && !req.user.role.includes("SUPER_ADMIN")) { const profile = await this.profileRepo.findOne({ relations: ["current_holders", "current_holders.orgRevision"], where: {