no message

This commit is contained in:
kittapath 2025-01-24 16:36:14 +07:00
parent f2b4ff93c6
commit ce504c6088

View file

@ -4215,9 +4215,7 @@ export class ProfileController extends Controller {
@Query() yearLeave?: number, @Query() yearLeave?: number,
@Query() isProbation?: boolean, @Query() isProbation?: boolean,
@Query() isRetire?: boolean, @Query() isRetire?: boolean,
@Query() node?: number,
@Query() nodeId?: string, @Query() nodeId?: string,
@Query() isAll?: boolean,
) { ) {
let queryLike = let queryLike =
"CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword"; "CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword";
@ -4236,24 +4234,16 @@ export class ProfileController extends Controller {
END LIKE :keyword END LIKE :keyword
`; `;
} }
let nodeCondition = "1=1"; let posMaster = await this.posMasterRepo.findOne({
let nodeAll = ""; where: {
if (node === 0 && nodeId) { current_holder: { keycloak: request.user.sub },
nodeCondition = "current_holders.orgRootId = :nodeId"; orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
if (isAll == false) nodeAll = " AND current_holders.orgChild1Id IS NULL"; },
} else if (node === 1 && nodeId) { });
nodeCondition = "current_holders.orgChild1Id = :nodeId"; if (nodeId == null) {
if (isAll == false) nodeAll = " AND current_holders.orgChild2Id IS NULL"; if (posMaster != null) nodeId = posMaster.orgRootId ?? "";
} else if (node === 2 && nodeId) {
nodeCondition = "current_holders.orgChild2Id = :nodeId";
if (isAll == false) nodeAll = " AND current_holders.orgChild3Id IS NULL";
} else if (node === 3 && nodeId) {
nodeCondition = "current_holders.orgChild3Id = :nodeId";
if (isAll == false) nodeAll = " AND current_holders.orgChild4Id IS NULL";
} else if (node === 4 && nodeId) {
nodeCondition = "current_holders.orgChild4Id = :nodeId";
} }
nodeCondition = nodeCondition + nodeAll; let nodeCondition = "current_holders.orgRootId = :nodeId";
const findRevision = await this.orgRevisionRepo.findOne({ const findRevision = await this.orgRevisionRepo.findOne({
where: { orgRevisionIsCurrent: true }, where: { orgRevisionIsCurrent: true },
}); });