rez_core 5.0.165 → 5.0.167

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.
Files changed (23) hide show
  1. package/dist/module/dashboard/service/dashboard.service.js +1 -1
  2. package/dist/module/dashboard/service/dashboard.service.js.map +1 -1
  3. package/dist/module/listmaster/entity/list-master.entity.d.ts +1 -0
  4. package/dist/module/listmaster/entity/list-master.entity.js +4 -0
  5. package/dist/module/listmaster/entity/list-master.entity.js.map +1 -1
  6. package/dist/module/meta/service/entity-dynamic.service.js +1 -1
  7. package/dist/module/meta/service/entity-dynamic.service.js.map +1 -1
  8. package/dist/module/module/controller/module-access.controller.d.ts +1 -1
  9. package/dist/module/module/controller/module-access.controller.js +6 -8
  10. package/dist/module/module/controller/module-access.controller.js.map +1 -1
  11. package/dist/module/module/repository/menu.repository.js +1 -1
  12. package/dist/module/module/repository/menu.repository.js.map +1 -1
  13. package/dist/module/module/service/module-access.service.d.ts +3 -4
  14. package/dist/module/module/service/module-access.service.js +7 -14
  15. package/dist/module/module/service/module-access.service.js.map +1 -1
  16. package/dist/tsconfig.build.tsbuildinfo +1 -1
  17. package/package.json +1 -1
  18. package/src/module/dashboard/service/dashboard.service.ts +1 -1
  19. package/src/module/listmaster/entity/list-master.entity.ts +3 -0
  20. package/src/module/meta/service/entity-dynamic.service.ts +1 -1
  21. package/src/module/module/controller/module-access.controller.ts +5 -6
  22. package/src/module/module/repository/menu.repository.ts +1 -1
  23. package/src/module/module/service/module-access.service.ts +22 -32
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "5.0.165",
3
+ "version": "5.0.167",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -20,7 +20,7 @@ export class DashboardService {
20
20
  appcode: loggedInUser.appcode,
21
21
  level_type: loggedInUser.level_type,
22
22
  level_id: loggedInUser.level_id,
23
- organization_id: loggedInUser.organization_id,
23
+ enterprise_id: loggedInUser.enterprise_id,
24
24
  });
25
25
 
26
26
  // Build a set of accessible codes
@@ -27,4 +27,7 @@ export class ListMasterData extends BaseEntity {
27
27
 
28
28
  @Column({ nullable: true })
29
29
  custom_source_id: number;
30
+
31
+ @Column({ nullable: true, default: '' })
32
+ description: string;
30
33
  }
@@ -515,7 +515,7 @@ export class EntityDynamicService {
515
515
  values.push(id);
516
516
 
517
517
  const updateQuery = `
518
- UPDATE ${tableName}
518
+ UPDATE ${this.schema}.${tableName}
519
519
  SET ${updates.join(', ')}
520
520
  WHERE id = ${idPlaceholder}
521
521
  `;
@@ -29,13 +29,12 @@ export class ModuleAccessController {
29
29
  @Query('include') include: string, // ✅ declare it as boolean
30
30
  @Request() req,
31
31
  ) {
32
- const { level_type, level_id, organization_id } = req.user.userData;
32
+ const { level_type, level_id } = req.user.userData;
33
33
 
34
34
  return this.moduleAccessService.getRoles({
35
35
  appcode,
36
36
  level_type,
37
37
  level_id,
38
- organization_id,
39
38
  include: include === 'true', // ensure it's either true or false
40
39
  });
41
40
  }
@@ -84,7 +83,7 @@ export class ModuleAccessController {
84
83
  }
85
84
 
86
85
  @Post('update')
87
- async updateModuleAccess(@Body() moduleAccessData: any[], @Request() req) {
86
+ async updateModuleAccess(@Body() moduleAccessData: any[]) {
88
87
  return this.moduleAccessService.updateModuleAccess(moduleAccessData);
89
88
  }
90
89
 
@@ -117,9 +116,9 @@ export class ModuleAccessController {
117
116
  const appcode = userData?.appcode;
118
117
  const level_type = userData?.level_type;
119
118
  const level_id = userData?.level_id;
120
- const organization_id = userData?.organization_id;
119
+ const enterprise_id = userData?.enterprise_id;
121
120
 
122
- if (!userId || !appcode || !level_type || !level_id || !organization_id) {
121
+ if (!userId || !appcode || !level_type || !level_id || !enterprise_id) {
123
122
  throw new BadRequestException('Invalid token data');
124
123
  }
125
124
 
@@ -128,7 +127,7 @@ export class ModuleAccessController {
128
127
  appcode,
129
128
  level_type,
130
129
  level_id,
131
- organization_id,
130
+ enterprise_id,
132
131
  });
133
132
  }
134
133
  }
@@ -120,7 +120,7 @@ export class MenuRepository extends Repository<MenuData> {
120
120
 
121
121
  if (
122
122
  getUserDetails &&
123
- getUserDetails.organization_id === 1 &&
123
+ getUserDetails.enterprise_id === 1 &&
124
124
  getUserUrm
125
125
  ) {
126
126
  return [Number(getUserUrm.role_id)];
@@ -21,26 +21,25 @@ export class ModuleAccessService {
21
21
  private readonly dataSource: DataSource,
22
22
  @Inject('ListMasterService')
23
23
  private readonly listMasterService: ListMasterService,
24
- private readonly reflectionHelper: ReflectionHelper
25
- ) {}
24
+ private readonly reflectionHelper: ReflectionHelper,
25
+ ) {
26
+ }
26
27
 
27
- async getModules({ appcode,loggedInUser }: { appcode: string ,loggedInUser: UserData}) {
28
+ async getModules({ appcode, loggedInUser }: { appcode: string, loggedInUser: UserData }) {
28
29
  return this.moduleAccessRepository.getModules({
29
- appcode,loggedInUser
30
+ appcode, loggedInUser,
30
31
  });
31
32
  }
32
33
 
33
34
  async getRoles({
34
- appcode,
35
- level_type,
36
- level_id,
37
- organization_id,
38
- include,
39
- }: {
35
+ appcode,
36
+ level_type,
37
+ level_id,
38
+ include,
39
+ }: {
40
40
  appcode: string;
41
41
  level_type?: string;
42
42
  level_id?: number;
43
- organization_id?: number;
44
43
  include?: boolean;
45
44
  }) {
46
45
  const query = this.dataSource
@@ -54,17 +53,8 @@ export class ModuleAccessService {
54
53
  query.andWhere('(role.is_factory IS NULL OR role.is_factory != 1)');
55
54
  }
56
55
 
57
- if (level_type) {
56
+ if (level_type && level_id) {
58
57
  query.andWhere('role.level_type = :level_type', { level_type });
59
- }
60
-
61
- if (organization_id) {
62
- query.andWhere('role.organization_id = :organization_id', {
63
- organization_id,
64
- });
65
- }
66
-
67
- if (level_id !== undefined) {
68
58
  query.andWhere('role.level_id = :level_id', {
69
59
  level_id: String(level_id),
70
60
  });
@@ -139,17 +129,17 @@ export class ModuleAccessService {
139
129
  }
140
130
 
141
131
  async getUserPermissions({
142
- userId,
143
- appcode,
144
- level_type,
145
- level_id,
146
- organization_id,
147
- }: {
132
+ userId,
133
+ appcode,
134
+ level_type,
135
+ level_id,
136
+ enterprise_id,
137
+ }: {
148
138
  userId: number;
149
139
  appcode: string;
150
140
  level_type: string;
151
141
  level_id: number;
152
- organization_id: number;
142
+ enterprise_id: number;
153
143
  }) {
154
144
  // Step 1: Resolve roles
155
145
  const roleCodes = await this.menuRepository.resolveUserRoles(
@@ -174,17 +164,17 @@ export class ModuleAccessService {
174
164
 
175
165
  // Step 3: If level_type is SCH, check school status using raw query
176
166
  if (level_type === 'SCH') {
177
- const schoolRepo = this.reflectionHelper.getRepoService('SSOSchool');
167
+ const schoolRepo = this.reflectionHelper.getRepoService('SSOSchool');
178
168
 
179
169
  const school = await schoolRepo.findOne({
180
170
  where: {
181
- id: level_id
182
- }
171
+ id: level_id,
172
+ },
183
173
  });
184
174
 
185
175
  const resolveStatus = await this.listMasterService.getResolvedListCode(
186
176
  STATUS_INACTIVE,
187
- organization_id || 0,
177
+ enterprise_id || 0,
188
178
  );
189
179
 
190
180
  if (!school || school.status === resolveStatus.id) {