no message
This commit is contained in:
parent
dc6e157ffe
commit
9db1ca7492
1 changed files with 41 additions and 37 deletions
|
|
@ -437,56 +437,60 @@ export class KeycloakController extends Controller {
|
||||||
|
|
||||||
if (req.user.role.includes("ADMIN")) {
|
if (req.user.role.includes("ADMIN")) {
|
||||||
const profile = await this.profileRepo.findOne({
|
const profile = await this.profileRepo.findOne({
|
||||||
relations:[
|
relations: ["current_holders", "current_holders.orgRevision"],
|
||||||
"current_holders",
|
|
||||||
"current_holders.orgRevision",
|
|
||||||
],
|
|
||||||
where: {
|
where: {
|
||||||
keycloak: req.user.sub,
|
keycloak: req.user.sub,
|
||||||
current_holders:{
|
current_holders: {
|
||||||
orgRevision:{
|
orgRevision: {
|
||||||
orgRevisionIsCurrent: true,
|
orgRevisionIsCurrent: true,
|
||||||
orgRevisionIsDraft: false
|
orgRevisionIsDraft: false,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if(profile?.current_holders[0].orgRootId && profile?.current_holders[0].orgChild1Id == null){
|
if (
|
||||||
condition =
|
profile?.current_holders[0]?.orgRootId &&
|
||||||
`current_holders.orgRootId = '${profile?.current_holders[0].orgRootId}'
|
profile?.current_holders[0]?.orgChild1Id == null
|
||||||
|
) {
|
||||||
|
condition = `current_holders.orgRootId = '${profile?.current_holders[0]?.orgRootId}'
|
||||||
and current_holders.orgChild1Id IS NULL
|
and current_holders.orgChild1Id IS NULL
|
||||||
and current_holders.orgChild2Id IS NULL
|
and current_holders.orgChild2Id IS NULL
|
||||||
and current_holders.orgChild3Id IS NULL
|
and current_holders.orgChild3Id IS NULL
|
||||||
and current_holders.orgChild4Id IS NULL`;
|
and current_holders.orgChild4Id IS NULL`;
|
||||||
}else if(profile?.current_holders[0].orgChild1Id && profile?.current_holders[0].orgChild2Id == null){
|
} else if (
|
||||||
condition =
|
profile?.current_holders[0]?.orgChild1Id &&
|
||||||
`current_holders.orgRootId = '${profile?.current_holders[0].orgRootId}'
|
profile?.current_holders[0]?.orgChild2Id == null
|
||||||
and current_holders.orgChild1Id '${profile?.current_holders[0].orgChild1Id}'
|
) {
|
||||||
|
condition = `current_holders.orgRootId = '${profile?.current_holders[0]?.orgRootId}'
|
||||||
|
and current_holders.orgChild1Id = '${profile?.current_holders[0]?.orgChild1Id}'
|
||||||
and current_holders.orgChild2Id IS NULL
|
and current_holders.orgChild2Id IS NULL
|
||||||
and current_holders.orgChild3Id IS NULL
|
and current_holders.orgChild3Id IS NULL
|
||||||
and current_holders.orgChild4Id IS NULL`;
|
and current_holders.orgChild4Id IS NULL`;
|
||||||
}else if(profile?.current_holders[0].orgChild2Id && profile?.current_holders[0].orgChild3Id == null){
|
} else if (
|
||||||
condition =
|
profile?.current_holders[0]?.orgChild2Id &&
|
||||||
`current_holders.orgRootId = '${profile?.current_holders[0].orgRootId}'
|
profile?.current_holders[0]?.orgChild3Id == null
|
||||||
and current_holders.orgChild1Id '${profile?.current_holders[0].orgChild1Id}'
|
) {
|
||||||
and current_holders.orgChild2Id '${profile?.current_holders[0].orgChild2Id}'
|
condition = `current_holders.orgRootId = '${profile?.current_holders[0]?.orgRootId}'
|
||||||
|
and current_holders.orgChild1Id = '${profile?.current_holders[0]?.orgChild1Id}'
|
||||||
|
and current_holders.orgChild2Id = '${profile?.current_holders[0]?.orgChild2Id}'
|
||||||
and current_holders.orgChild3Id IS NULL
|
and current_holders.orgChild3Id IS NULL
|
||||||
and current_holders.orgChild4Id IS NULL`;
|
and current_holders.orgChild4Id IS NULL`;
|
||||||
}else if(profile?.current_holders[0].orgChild3Id && profile?.current_holders[0].orgChild4Id == null){
|
} else if (
|
||||||
condition =
|
profile?.current_holders[0]?.orgChild3Id &&
|
||||||
`current_holders.orgRootId = '${profile?.current_holders[0].orgRootId}'
|
profile?.current_holders[0]?.orgChild4Id == null
|
||||||
and current_holders.orgChild1Id '${profile?.current_holders[0].orgChild1Id}'
|
) {
|
||||||
and current_holders.orgChild2Id '${profile?.current_holders[0].orgChild2Id}'
|
condition = `current_holders.orgRootId = '${profile?.current_holders[0]?.orgRootId}'
|
||||||
and current_holders.orgChild3Id '${profile?.current_holders[0].orgChild3Id}'
|
and current_holders.orgChild1Id = '${profile?.current_holders[0]?.orgChild1Id}'
|
||||||
|
and current_holders.orgChild2Id = '${profile?.current_holders[0]?.orgChild2Id}'
|
||||||
|
and current_holders.orgChild3Id = '${profile?.current_holders[0]?.orgChild3Id}'
|
||||||
and current_holders.orgChild4Id IS NULL`;
|
and current_holders.orgChild4Id IS NULL`;
|
||||||
}else if(profile?.current_holders[0].orgChild4Id){
|
} else if (profile?.current_holders[0]?.orgChild4Id) {
|
||||||
condition =
|
condition = `current_holders.orgRootId = '${profile?.current_holders[0]?.orgRootId}'
|
||||||
`current_holders.orgRootId = '${profile?.current_holders[0].orgRootId}'
|
and current_holders.orgChild1Id = '${profile?.current_holders[0]?.orgChild1Id}'
|
||||||
and current_holders.orgChild1Id '${profile?.current_holders[0].orgChild1Id}'
|
and current_holders.orgChild2Id = '${profile?.current_holders[0]?.orgChild2Id}'
|
||||||
and current_holders.orgChild2Id '${profile?.current_holders[0].orgChild2Id}'
|
and current_holders.orgChild3Id = '${profile?.current_holders[0]?.orgChild3Id}'
|
||||||
and current_holders.orgChild3Id '${profile?.current_holders[0].orgChild3Id}'
|
and current_holders.orgChild4Id = '${profile?.current_holders[0]?.orgChild4Id}'`;
|
||||||
and current_holders.orgChild4Id '${profile?.current_holders[0].orgChild4Id}'`;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let profiles: any = [];
|
let profiles: any = [];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue