rez_core 2.1.71 → 2.1.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/enterprise/controller/organization.controller.js +2 -1
- package/dist/module/enterprise/controller/organization.controller.js.map +1 -1
- package/dist/module/enterprise/repository/school.repository.d.ts +1 -1
- package/dist/module/enterprise/repository/school.repository.js +6 -2
- package/dist/module/enterprise/repository/school.repository.js.map +1 -1
- package/dist/module/enterprise/service/organization.service.d.ts +1 -1
- package/dist/module/enterprise/service/organization.service.js +2 -2
- package/dist/module/enterprise/service/organization.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/enterprise/controller/organization.controller.ts +6 -1
- package/src/module/enterprise/repository/school.repository.ts +7 -2
- package/src/module/enterprise/service/organization.service.ts +10 -2
package/package.json
CHANGED
|
@@ -26,7 +26,12 @@ export class OrganizationController {
|
|
|
26
26
|
async getOrganizationHierarchy(@Req() req: Request & { user: any }) {
|
|
27
27
|
const userId = req.user.userData?.id;
|
|
28
28
|
const appcode = req.user.userData?.appcode;
|
|
29
|
+
const org_id = req.user.userData?.organization_id;
|
|
29
30
|
|
|
30
|
-
return await this.orgService.getOrganizationHierarchy(
|
|
31
|
+
return await this.orgService.getOrganizationHierarchy(
|
|
32
|
+
userId,
|
|
33
|
+
appcode,
|
|
34
|
+
org_id,
|
|
35
|
+
);
|
|
31
36
|
}
|
|
32
37
|
}
|
|
@@ -24,7 +24,7 @@ export class SchoolRepository {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
async getUserContextDropdown(userId: number, appCode: string) {
|
|
27
|
+
async getUserContextDropdown(userId: number, appCode: string, org_id) {
|
|
28
28
|
const userRoleRepo = this.dataSource.getRepository(UserRoleMapping);
|
|
29
29
|
|
|
30
30
|
const hasOrgAccess = await userRoleRepo
|
|
@@ -34,6 +34,11 @@ export class SchoolRepository {
|
|
|
34
34
|
.andWhere('urm.level_type = :levelType', { levelType: 'ORG' })
|
|
35
35
|
.getRawMany();
|
|
36
36
|
|
|
37
|
+
let currentORGLevel_id = hasOrgAccess[0]?.urm_level_id;
|
|
38
|
+
if (hasOrgAccess[0].urm_level_id == 1) {
|
|
39
|
+
currentORGLevel_id = org_id;
|
|
40
|
+
}
|
|
41
|
+
|
|
37
42
|
if (hasOrgAccess.length > 0) {
|
|
38
43
|
const schools = await this.dataSource
|
|
39
44
|
.createQueryBuilder()
|
|
@@ -53,7 +58,7 @@ export class SchoolRepository {
|
|
|
53
58
|
.from('cr_school', 'sch')
|
|
54
59
|
.innerJoin('cr_brand', 'br', 'sch.brand_id = br.id')
|
|
55
60
|
.innerJoin('cr_organization', 'org', 'br.organization_id = org.id')
|
|
56
|
-
.where('org.id = :orgId', { orgId:
|
|
61
|
+
.where('org.id = :orgId', { orgId: currentORGLevel_id })
|
|
57
62
|
.getRawMany();
|
|
58
63
|
|
|
59
64
|
const result = {};
|
|
@@ -78,7 +78,15 @@ export class OrganizationService {
|
|
|
78
78
|
await repo.delete(id);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
async getOrganizationHierarchy(
|
|
82
|
-
|
|
81
|
+
async getOrganizationHierarchy(
|
|
82
|
+
userId: number,
|
|
83
|
+
appCode: string,
|
|
84
|
+
orgId: number,
|
|
85
|
+
) {
|
|
86
|
+
return await this.schoolRepository.getUserContextDropdown(
|
|
87
|
+
userId,
|
|
88
|
+
appCode,
|
|
89
|
+
orgId,
|
|
90
|
+
);
|
|
83
91
|
}
|
|
84
92
|
}
|