rez_core 2.0.98 → 2.0.100

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.98",
3
+ "version": "2.0.100",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -155,36 +155,42 @@ export class FilterService {
155
155
  const layout = layoutPreference?.[0]?.layout_json?.quick_tab || {};
156
156
  let showList = layout?.show_list?.map((val) => val.toLowerCase()) || [];
157
157
 
158
- // If 'All' is selected, include 'all'
159
- if (layout?.isAllSelected) {
160
- if (!showList.includes('all')) {
161
- showList.push('all');
162
- }
163
- }
158
+ let filteredTabs;
164
159
 
165
- // Filter `allTabs` using showList (case-insensitive)
166
- const filteredTabs = allTabs.filter((tab) =>
167
- showList.includes(tab.tab_value.toLowerCase()),
168
- );
160
+ if (showList?.length > 0) {
161
+ // If 'All' is selected, include 'all'
162
+ if (layout?.isAllSelected) {
163
+ if (!showList.includes('all')) {
164
+ showList.push('all');
165
+ }
166
+ }
169
167
 
170
- // If combine other is enabled
171
- if (layout?.isCombineOther) {
172
- const allTab = allTabs.find(
173
- (tab) => tab.tab_value.toLowerCase() === 'all',
168
+ // Filter `allTabs` using showList (case-insensitive)
169
+ filteredTabs = allTabs.filter((tab) =>
170
+ showList.includes(tab.tab_value.toLowerCase()),
174
171
  );
175
- const allCount = allTab?.tab_value_count ?? 0;
176
172
 
177
- // Calculate sum of filtered (excluding 'All')
178
- const knownTabCountSum = filteredTabs
179
- .filter((tab) => tab.tab_value.toLowerCase() !== 'all')
180
- .reduce((acc, tab) => acc + tab.tab_value_count, 0);
173
+ // If combine other is enabled
174
+ if (layout?.isCombineOther) {
175
+ const allTab = allTabs.find(
176
+ (tab) => tab.tab_value.toLowerCase() === 'all',
177
+ );
178
+ const allCount = allTab?.tab_value_count ?? 0;
179
+
180
+ // Calculate sum of filtered (excluding 'All')
181
+ const knownTabCountSum = filteredTabs
182
+ .filter((tab) => tab.tab_value.toLowerCase() !== 'all')
183
+ .reduce((acc, tab) => acc + tab.tab_value_count, 0);
181
184
 
182
- const othersCount = allCount - knownTabCountSum;
185
+ const othersCount = allCount - knownTabCountSum;
183
186
 
184
- filteredTabs.push({
185
- tab_value: 'OTHERS',
186
- tab_value_count: othersCount < 0 ? 0 : othersCount, // safe fallback
187
- });
187
+ filteredTabs.push({
188
+ tab_value: 'OTHERS',
189
+ tab_value_count: othersCount < 0 ? 0 : othersCount, // safe fallback
190
+ });
191
+ }
192
+ } else {
193
+ filteredTabs = allTabs;
188
194
  }
189
195
 
190
196
  // Add tab.value filter only if present
@@ -215,15 +221,6 @@ export class FilterService {
215
221
  qb.andWhere(clause.query, clause.params);
216
222
  });
217
223
 
218
- //prefernec.sort_by.length>0 if()
219
-
220
- // "sortby": [
221
- // {
222
- // "order": "asc",
223
- // "column": "customer_name"
224
- // }
225
- // ],
226
-
227
224
  if (Array.isArray(sortby)) {
228
225
  // Optional sorting
229
226
  sortby.forEach(({ sortColum, sortType }) => {
@@ -71,8 +71,11 @@ export class LoginController {
71
71
  const currentUser = req.user.userData;
72
72
  const currentAppcode = currentUser.appcode;
73
73
 
74
+ console.log(currentUser, 'DEBUG USER', data);
75
+
74
76
  // If appcode is changing, validate the new level_id/level_type
75
77
  if (data.appcode !== currentAppcode) {
78
+ console.log('inside if', data.appcode, currentAppcode);
76
79
  const isValidAccess = await this.userSessionService.checkIfUserHasMapping(
77
80
  currentUser.id,
78
81
  data.appcode,
@@ -80,6 +83,8 @@ export class LoginController {
80
83
  data.level_id,
81
84
  );
82
85
 
86
+ console.log('isValidAccess', isValidAccess);
87
+
83
88
  if (!isValidAccess) {
84
89
  // If not valid, fetch the default one
85
90
  const userMapping =
@@ -97,6 +102,11 @@ export class LoginController {
97
102
  data.level_type = userMapping.level_type;
98
103
  data.level_id = userMapping.level_id;
99
104
  }
105
+ console.log(
106
+ data.level_type,
107
+ data.level_id,
108
+ 'data.level_type, data.level_id',
109
+ );
100
110
  }
101
111
 
102
112
  return await this.userSessionService.switchCurrentLevelService(
@@ -29,6 +29,7 @@ export class RoleService extends EntityServiceImpl {
29
29
  // if level_type and level_id are not provided, use loggedInUser's values
30
30
  role.level_type = entityData.level_type || loggedInUser.level_type;
31
31
  role.level_id = entityData.level_id || loggedInUser.level_id;
32
+ role.appcode = entityData.appcode || loggedInUser.appcode;
32
33
 
33
34
  if (
34
35
  await this.roleRepository.isRoleNameWithLevelExists(role.name, {
@@ -62,6 +63,7 @@ export class RoleService extends EntityServiceImpl {
62
63
  module_code: perm.module_code,
63
64
  action_type: perm.action_type,
64
65
  access_flag: perm.access_flag,
66
+ level_type: perm.level_type,
65
67
  appcode: perm.appcode,
66
68
  }),
67
69
  );
@@ -143,6 +145,7 @@ export class RoleService extends EntityServiceImpl {
143
145
  action_type: perm.action_type,
144
146
  access_flag: perm.access_flag,
145
147
  appcode: perm.appcode,
148
+ level_type: perm.level_type,
146
149
  }),
147
150
  );
148
151