rez_core 2.0.13 → 2.0.14

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": "2.0.13",
3
+ "version": "2.0.14",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -40,7 +40,10 @@ export class ModuleData {
40
40
 
41
41
  @Column({ type: 'json', nullable: true })
42
42
  ui_config: JSON;
43
-
43
+
44
44
  @Column({ type: 'varchar', length: 100, nullable: true })
45
45
  appcode: string;
46
+
47
+ @Column({ type: 'varchar', length: 100, nullable: true })
48
+ type: string;
46
49
  }
@@ -23,55 +23,61 @@ export class MenuRepository extends Repository<MenuData> {
23
23
  .where('urm.user_id = :userId', { userId })
24
24
  .andWhere('role.appcode = :appcode', { appcode })
25
25
  .getRawMany();
26
-
27
- return roles. map((r) => r.urm_role_id);
26
+
27
+ return roles.map((r) => r.urm_role_id);
28
28
  }
29
-
30
29
 
31
30
  /**
32
31
  * Get module codes that the user has access to based on their role IDs.
33
- */async getAccessibleModules(roleIds: number[], appCode: string): Promise<string[]> {
34
- // Get role codes from role IDs
35
- const roleCodes = await this.dataSource
36
- .getRepository(Role)
37
- .createQueryBuilder('role')
38
- .select('role.code')
39
- .where('role.id IN (:...roleIds)', { roleIds })
40
- .getMany();
41
-
42
- const codes = roleCodes.map((role) => role.code);
32
+ */ async getAccessibleModules(
33
+ roleIds: number[],
34
+ appCode: string,
35
+ ): Promise<string[]> {
36
+ // Get role codes from role IDs
37
+ const roleCodes = await this.dataSource
38
+ .getRepository(Role)
39
+ .createQueryBuilder('role')
40
+ .select('role.code')
41
+ .where('role.id IN (:...roleIds)', { roleIds })
42
+ .getMany();
43
43
 
44
- if (codes.length === 0) {
45
- return [];
46
- }
44
+ const codes = roleCodes.map((role) => role.code);
47
45
 
48
- // Get accessible modules using role codes and appCode
49
- const modules = await this.dataSource
50
- .getRepository(ModuleAccess)
51
- .createQueryBuilder('moduleAccess')
52
- .select('moduleAccess.module_code')
53
- .where('moduleAccess.role_code IN (:...codes)', { codes })
54
- .andWhere('moduleAccess.access_flag > 0')
55
- .andWhere('LOWER(moduleAccess.appcode) = LOWER(:appCode)', { appCode }) // case-insensitive
56
- .getMany();
46
+ if (codes.length === 0) {
47
+ return [];
48
+ }
57
49
 
58
- return modules.map((module) => module.module_code);
59
- }
50
+ // Get accessible modules using role codes and appCode
51
+ const modules = await this.dataSource
52
+ .getRepository(ModuleAccess)
53
+ .createQueryBuilder('moduleAccess')
54
+ .select('moduleAccess.module_code')
55
+ .where('moduleAccess.role_code IN (:...codes)', { codes })
56
+ .andWhere('moduleAccess.access_flag > 0')
57
+ .andWhere('LOWER(moduleAccess.appcode) = LOWER(:appCode)', { appCode }) // case-insensitive
58
+ .getMany();
60
59
 
61
- async getMenuItems(moduleCodes: string[], appcode: string): Promise<MenuData[]> {
62
- const menuItems = await this.createQueryBuilder('menu')
63
- .leftJoin('cr_module', 'module', 'menu.module_code = module.module_code')
64
- .where('menu.module_code IN (:...moduleCodes)', { moduleCodes })
65
- .andWhere('LOWER(module.appcode) = LOWER(:appcode)', { appcode }) // appcode filter
66
- .select([
67
- 'menu.*',
68
- 'module.component_name AS component',
69
- 'module.title AS title',
70
- 'module.entity_type AS entity_type',
71
- ])
72
- .getRawMany();
60
+ return modules.map((module) => module.module_code);
61
+ }
73
62
 
74
- return menuItems;
75
- }
63
+ async getMenuItems(
64
+ moduleCodes: string[],
65
+ appcode: string,
66
+ ): Promise<MenuData[]> {
67
+ const menuItems = await this.createQueryBuilder('menu')
68
+ .leftJoin('cr_module', 'module', 'menu.module_code = module.module_code')
69
+ .where('menu.module_code IN (:...moduleCodes)', { moduleCodes })
70
+ .andWhere('LOWER(module.appcode) = LOWER(:appcode)', { appcode }) // appcode filter
71
+ .select([
72
+ 'menu.*',
73
+ 'module.component_name AS component',
74
+ 'module.title AS title',
75
+ 'module.entity_type AS entity_type',
76
+ 'module.type AS type',
77
+ 'module.ui_config AS ui_config',
78
+ ])
79
+ .getRawMany();
76
80
 
81
+ return menuItems;
82
+ }
77
83
  }