diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index c846859a..e2bd35ba 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -4136,7 +4136,14 @@ export class ProfileController extends Controller { .leftJoinAndSelect("current_holders.orgChild2", "orgChild2") .leftJoinAndSelect("current_holders.orgChild3", "orgChild3") .leftJoinAndSelect("current_holders.orgChild4", "orgChild4") - .where("current_holders.orgRevisionId = :orgRevisionId", { orgRevisionId: findRevision.id }) + .where( + node && nodeId + ? "current_holders.orgRevisionId = :orgRevisionId" + : "1=1", + { + orgRevisionId: node && nodeId ? findRevision.id : undefined, + } + ) .andWhere( _data.root != undefined && _data.root != null ? _data.root[0] != null diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index dff5fe59..760c0c1f 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -1454,7 +1454,14 @@ export class ProfileEmployeeController extends Controller { .leftJoinAndSelect("current_holders.orgChild2", "orgChild2") .leftJoinAndSelect("current_holders.orgChild3", "orgChild3") .leftJoinAndSelect("current_holders.orgChild4", "orgChild4") - .where("current_holders.orgRevisionId = :orgRevisionId", { orgRevisionId: findRevision.id }) + .where( + node && nodeId + ? "current_holders.orgRevisionId = :orgRevisionId" + : "1=1", + { + orgRevisionId: node && nodeId ? findRevision.id : undefined, + } + ) .andWhere( _data.root != undefined && _data.root != null ? _data.root[0] != null