rez_core 6.5.56 → 6.5.58

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "6.5.56",
3
+ "version": "6.5.58",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -23,10 +23,10 @@ export class ModuleAccessRepository {
23
23
  }
24
24
 
25
25
  async getRoles({
26
- appcode,
27
- level_type,
28
- level_id,
29
- }: {
26
+ appcode,
27
+ level_type,
28
+ level_id,
29
+ }: {
30
30
  appcode: string;
31
31
  level_type?: string;
32
32
  level_id?: number;
@@ -58,9 +58,9 @@ export class ModuleAccessRepository {
58
58
  }
59
59
 
60
60
  async getModules({
61
- appcode,
62
- loggedInUser,
63
- }: {
61
+ appcode,
62
+ loggedInUser,
63
+ }: {
64
64
  appcode: string;
65
65
  loggedInUser: any;
66
66
  }) {
@@ -157,15 +157,16 @@ export class ModuleAccessRepository {
157
157
  module_id: access.module_id,
158
158
  level_type: access.level_type,
159
159
  app_id: access.app_id,
160
- code: access.module.module_code,
160
+ code: access?.module?.module_code,
161
161
  appcode: access.app.code,
162
162
  })),
163
163
  }));
164
164
  }
165
165
 
166
166
  async getAllModulesByLevel(mainModIds: string[], appcode: string, levelType) {
167
+
167
168
  const appMasterRepo = this.reflectionHelper.getRepoService('AppMaster');
168
- // TODO Permissions not getting populated
169
+ // TODO Permissions not getting populated
169
170
  const appMaster = await appMasterRepo.find({
170
171
  where: {
171
172
  code: appcode,
@@ -209,28 +210,25 @@ export class ModuleAccessRepository {
209
210
 
210
211
  const modules = allModules.map((m) => m.id);
211
212
 
212
- const allActions: any = await this.moduleActionRepo.createQueryBuilder('action')
213
- .select(['action.id', 'action.action_name', 'module.module_code'])
214
- .leftJoin('action.module', 'module')
215
- .where('module.module_id IN (:...modules)', { modules })
216
- .getMany();
213
+ const allActions = await this.moduleActionRepo.find({
214
+ where: {
215
+ module_id: In(modules),
216
+ }
217
+ })
217
218
 
218
219
  // Map actions by module_code with VIEW action first
219
220
  const actionMap = allActions.reduce(
220
221
  (acc, action) => {
221
- if (!acc[action.module_code]) acc[action.module_code] = [];
222
-
222
+ if (!acc[action?.module_id]) acc[action?.module_id] = [];
223
223
  const actionItem = {
224
224
  action: action.action_code,
225
225
  name: action.action_name,
226
226
  };
227
-
228
227
  if (action.action_code === 'VIEW') {
229
- acc[action.module_code].unshift(actionItem); // ➕ Add VIEW at start
228
+ acc[action?.module_id].unshift(actionItem); // ➕ Add VIEW at start
230
229
  } else {
231
- acc[action.module_code].push(actionItem); // ➕ Add others at end
230
+ acc[action?.module_id].push(actionItem); // ➕ Add others at end
232
231
  }
233
-
234
232
  return acc;
235
233
  },
236
234
  {} as Record<string, { action: string; name: string }[]>,
@@ -255,7 +253,7 @@ export class ModuleAccessRepository {
255
253
  name: mod.name,
256
254
  module_id: mod.id,
257
255
  code: mod.module_code,
258
- permission: actionMap[mod.module_code] || [],
256
+ permission: actionMap[mod.id] || [],
259
257
  submod: buildHierarchy(mod.wbs_code),
260
258
  }));
261
259
 
@@ -265,7 +263,7 @@ export class ModuleAccessRepository {
265
263
  name: mod.name,
266
264
  module_id: mod.id,
267
265
  code: mod.module_code,
268
- permission: actionMap[mod.module_code] || [],
266
+ permission: actionMap[mod.id] || [],
269
267
  submod: buildHierarchy(mod.wbs_code),
270
268
  }));
271
269