fix and add profile by key cloak

This commit is contained in:
AdisakKanthawilang 2024-05-24 18:06:54 +07:00
parent 7b480b1247
commit eb85bdcb45
5 changed files with 143 additions and 19 deletions

View file

@ -2529,8 +2529,8 @@ export class PositionController extends Controller {
nodeId: string;
position: string;
typeCommand: string | null;
posType: string;
posLevel: string;
posType?: string | null;
posLevel?: string | null;
isAll: boolean;
isBlank: boolean;
},
@ -2545,13 +2545,15 @@ export class PositionController extends Controller {
where: { id: String(body.posLevel) },
});
if (body.typeCommand == "APPOINTED" || body.typeCommand == "MOVE") {
conditionA = "positions.posTypeId LIKE :posType AND positions.posLevelId LIKE :posLevel";
} else if (body.typeCommand == "APPOINT") {
conditionA = "posType.posTypeRank > :posTypeRank";
} else if (body.typeCommand == "SLIP") {
conditionA = "positions.posTypeId LIKE :posType AND posLevel.posLevelRank > :posLevelRank";
}
if (body.typeCommand == "APPOINTED" || body.typeCommand == "MOVE") {
conditionA =
"positions.posTypeId LIKE :posType AND positions.posLevelId LIKE :posLevel";
} else if (body.typeCommand == "APPOINT") {
conditionA = "posType.posTypeRank > :posTypeRank";
} else if (body.typeCommand == "SLIP") {
conditionA =
"positions.posTypeId LIKE :posType AND posLevel.posLevelRank > :posLevelRank";
}
if (body.isAll == false) {
if (body.node === 0) {
@ -2629,10 +2631,10 @@ export class PositionController extends Controller {
.andWhere(
new Brackets((qb) => {
qb.andWhere(typeCondition).andWhere(conditionA == null ? "1=1" : conditionA, {
posType: `${body.posType}`,
posLevel: `${body.posLevel}`,
posTypeRank: posType == null ? 0 : posType.posTypeRank,
posLevelRank: posLevel == null ? 0 : posLevel.posLevelRank,
posType: posType == null ? `%%` : `%${posType.id}%`,
posLevel: posLevel == null ? `%%` : `%${posLevel.id}%`,
posTypeRank: posType == null ? "" : posType.posTypeRank,
posLevelRank: posLevel == null ? "" : posLevel.posLevelRank,
});
}),
)
@ -2754,8 +2756,8 @@ export class PositionController extends Controller {
nodeId: string;
position: string;
typeCommand: string | null;
posType: string;
posLevel: string;
posType?: string | null;
posLevel?: string | null;
isAll: boolean;
isBlank: boolean;
},
@ -2854,10 +2856,10 @@ export class PositionController extends Controller {
.andWhere(
new Brackets((qb) => {
qb.andWhere(typeCondition).andWhere(conditionA == null ? "1=1" : conditionA, {
posType: `${body.posType}`,
posLevel: `${body.posLevel}`,
posTypeRank: posType == null ? 0 : posType.posTypeRank,
posLevelRank: posLevel == null ? 0 : posLevel.posLevelRank,
posType: posType == null ? `%%` : `%${posType.id}%`,
posLevel: posLevel == null ? `%%` : `%${posLevel.id}%`,
posTypeRank: posType == null ? "" : posType.posTypeRank,
posLevelRank: posLevel == null ? "" : posLevel.posLevelRank,
});
}),
)