rez_core 4.0.91 → 4.0.93

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": "4.0.91",
3
+ "version": "4.0.93",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -37,7 +37,7 @@ export class ListMasterService {
37
37
  private readonly configService: ConfigService,
38
38
  ) {}
39
39
 
40
- private readonly skipLevelFilterEntities = ['BRN','USR','UPR'];
40
+ private readonly skipLevelFilterEntities = ['BRN', 'USR', 'UPR', 'BRNP'];
41
41
  private readonly actions = new Map<string, Action>();
42
42
 
43
43
  registerAction(actionName: string, actionInstance: Action) {
@@ -174,20 +174,20 @@ export class ListMasterService {
174
174
  );
175
175
  let result: { label: string; value: number }[] = [];
176
176
  if (!sourceList) return result;
177
-
177
+
178
178
  const entityMaster = await this.entityMasterService.getEntityData(
179
179
  sourceList,
180
180
  loggedInUser,
181
181
  );
182
182
  const tableName = entityMaster.data_source;
183
-
183
+
184
184
  const applyCommonFilters = (qb: any, status?: number) => {
185
185
  if (status) {
186
186
  const isView = tableName.endsWith('_vw'); // auto-detect view
187
187
  const statusColumn = isView ? 'status_id' : 'status';
188
188
  qb.andWhere(`${tableName}.${statusColumn} = :status`, { status });
189
189
  }
190
-
190
+
191
191
  if (loggedInUser?.level_type && loggedInUser?.level_id) {
192
192
  // Skip level filter for certain entities
193
193
  if (!this.skipLevelFilterEntities.includes(sourceList)) {
@@ -199,31 +199,31 @@ export class ListMasterService {
199
199
  organization_id: loggedInUser.organization_id,
200
200
  },
201
201
  );
202
- }
203
- }
204
-
205
- if(sourceList=="BRN"){
206
-
207
- // IN the case of BRN, we don't filter by level
208
- qb.andWhere(
209
- `${tableName}.parent_id = :organization_id AND ${tableName}.type = 'BRN'`,
210
- { organization_id: loggedInUser?.organization_id },
211
- );
212
-
202
+ }
213
203
  }
214
204
 
215
- if(sourceList=="USR" || sourceList=="UPR"){
216
-
205
+ if (sourceList == 'BRN') {
217
206
  // IN the case of BRN, we don't filter by level
218
207
  qb.andWhere(
219
- `${tableName}.organization_id = :organization_id`,
208
+ `${tableName}.parent_id = :organization_id AND ${tableName}.type = 'BRN'`,
220
209
  { organization_id: loggedInUser?.organization_id },
221
210
  );
222
-
223
- }
211
+ }
212
+
213
+ if (sourceList == 'BRNP') {
214
+ // IN the case of BRNP, we only filter by organization_id
215
+ qb.andWhere(`${tableName}.organization_id = :organization_id`, {
216
+ organization_id: loggedInUser?.organization_id,
217
+ });
218
+ }
219
+
220
+ if (sourceList == 'USR' || sourceList == 'UPR') {
221
+ // IN the case of USR/UPR, we don't filter by level
222
+ qb.andWhere(`${tableName}.organization_id = :organization_id`, {
223
+ organization_id: loggedInUser?.organization_id,
224
+ });
225
+ }
224
226
 
225
-
226
-
227
227
  if (loggedInUser?.appcode && sourceList === 'ROL') {
228
228
  if (!this.skipLevelFilterEntities.includes(sourceList)) {
229
229
  qb.andWhere(`${tableName}.appcode = :appcode`, {
@@ -231,27 +231,27 @@ export class ListMasterService {
231
231
  });
232
232
  }
233
233
  }
234
-
234
+
235
235
  // ✅ Apply dynamic params
236
236
  for (const key in params) {
237
237
  qb.andWhere(`${tableName}.${key} = :${key}`, {
238
238
  [key]: params[key],
239
239
  });
240
240
  }
241
-
241
+
242
242
  // ✅ New: Exclude customers for USR/UPR
243
243
  if (sourceList === 'USR' || sourceList === 'UPR') {
244
244
  qb.andWhere(`${tableName}.is_customer is NULL`);
245
245
  }
246
-
246
+
247
247
  return qb;
248
248
  };
249
-
249
+
250
250
  const resolveStatus = await this.getResolvedListCode(
251
251
  STATUS_ACTIVE,
252
252
  loggedInUser?.organization_id || 0,
253
253
  );
254
-
254
+
255
255
  // Fetch active records
256
256
  const activeQuery = applyCommonFilters(
257
257
  this.entityManager
@@ -260,20 +260,20 @@ export class ListMasterService {
260
260
  .from(tableName, tableName),
261
261
  resolveStatus.id,
262
262
  );
263
-
263
+
264
264
  const activeResults = await activeQuery.getRawMany();
265
265
  const activeIds = new Set(activeResults.map((r) => r.id));
266
-
266
+
267
267
  // Add active entries first
268
268
  activeResults.forEach((r) => {
269
269
  result.push({ label: r.name, value: r.id });
270
270
  });
271
-
271
+
272
272
  const resolveInactiveStatus = await this.getResolvedListCode(
273
273
  STATUS_INACTIVE,
274
274
  loggedInUser?.organization_id || 0,
275
275
  );
276
-
276
+
277
277
  // Fetch inactive records (with same filters but without status condition)
278
278
  if (inactiveIdsArray?.length) {
279
279
  const inactiveQuery = applyCommonFilters(
@@ -283,13 +283,13 @@ export class ListMasterService {
283
283
  .from(tableName, tableName),
284
284
  resolveInactiveStatus.id,
285
285
  );
286
-
286
+
287
287
  inactiveQuery.andWhere(`${tableName}.id IN (:...ids)`, {
288
288
  ids: inactiveIdsArray,
289
289
  });
290
-
290
+
291
291
  const inactiveResults = await inactiveQuery.getRawMany();
292
-
292
+
293
293
  inactiveResults.forEach((item) => {
294
294
  if (!activeIds.has(item.id)) {
295
295
  result.push({
@@ -299,10 +299,9 @@ export class ListMasterService {
299
299
  }
300
300
  });
301
301
  }
302
-
302
+
303
303
  return result;
304
304
  }
305
-
306
305
 
307
306
  private async fetchFromExternalSource(
308
307
  customSourceId: number,
@@ -441,21 +441,6 @@ export class EntityDynamicService {
441
441
  entityData.enterprise_id = loggedInUser.enterprise_id;
442
442
  }
443
443
 
444
- if (!entityData.code && loggedInUser) {
445
- const result = await this.dataSource.query(
446
- `SELECT MAX(CAST(SUBSTRING(code, LENGTH(entity_type) + 1) AS UNSIGNED)) AS max_seq_no
447
- FROM ${tableName}
448
- WHERE entity_type = ?`,
449
- [entityData.entity_type],
450
- );
451
-
452
- // result will be like [ { max_seq_no: 12 } ]
453
- let maxSeqNo = result?.[0]?.max_seq_no ? Number(result[0].max_seq_no) : 0;
454
-
455
- maxSeqNo += 1;
456
- entityData.code = `${entityData.entity_type}${maxSeqNo}`;
457
- }
458
-
459
444
  // Set parent_id if mainID is provided
460
445
  if (mainID) {
461
446
  entityData.parent_id = mainID;
@@ -46,13 +46,14 @@ export class ActionTemplateMappingService extends EntityServiceImpl {
46
46
  `
47
47
  SELECT code as value, name as label , id
48
48
  FROM frm_wf_comm_template
49
- WHERE mode = ? AND organization_id = ? AND level_type = ? AND level_id = ?
49
+ WHERE mode = ? AND organization_id = ? AND level_type = ? AND level_id = ? AND status IN (SELECT id FROM frm_list_master_items WHERE code = "STATUS_ACTIVE" AND organization_id = ?)
50
50
  `,
51
51
  [
52
52
  modeId,
53
53
  loggedInUser.organization_id,
54
54
  loggedInUser.level_type,
55
55
  loggedInUser.level_id,
56
+ loggedInUser.organization_id,
56
57
  ],
57
58
  );
58
59
 
@@ -88,7 +89,7 @@ export class ActionTemplateMappingService extends EntityServiceImpl {
88
89
  `
89
90
  SELECT code as value, name as label , id
90
91
  FROM frm_wf_comm_template
91
- WHERE code IN (?) AND mode = ? AND organization_id = ? AND level_type = ? AND level_id = ?
92
+ WHERE code IN (?) AND mode = ? AND organization_id = ? AND level_type = ? AND level_id = ? AND status IN (SELECT id FROM frm_list_master_items WHERE code = "STATUS_ACTIVE" AND organization_id = ?)
92
93
  `,
93
94
  [
94
95
  templateCodes,
@@ -96,6 +97,7 @@ export class ActionTemplateMappingService extends EntityServiceImpl {
96
97
  loggedInUser.organization_id,
97
98
  loggedInUser.level_type,
98
99
  loggedInUser.level_id,
100
+ loggedInUser.organization_id,
99
101
  ],
100
102
  );
101
103
 
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
- <excludeFolder url="file://$MODULE_DIR$/temp" />
7
- <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
- </content>
9
- <orderEntry type="inheritedJdk" />
10
- <orderEntry type="sourceFolder" forTests="false" />
11
- </component>
12
- </module>
@@ -1,59 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <code_scheme name="Project" version="173">
3
- <HTMLCodeStyleSettings>
4
- <option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
5
- </HTMLCodeStyleSettings>
6
- <JSCodeStyleSettings version="0">
7
- <option name="FORCE_SEMICOLON_STYLE" value="true" />
8
- <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
9
- <option name="USE_DOUBLE_QUOTES" value="false" />
10
- <option name="FORCE_QUOTE_STYlE" value="true" />
11
- <option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
12
- <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
13
- <option name="SPACES_WITHIN_IMPORTS" value="true" />
14
- </JSCodeStyleSettings>
15
- <TypeScriptCodeStyleSettings version="0">
16
- <option name="FORCE_SEMICOLON_STYLE" value="true" />
17
- <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
18
- <option name="USE_DOUBLE_QUOTES" value="false" />
19
- <option name="FORCE_QUOTE_STYlE" value="true" />
20
- <option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
21
- <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
22
- <option name="SPACES_WITHIN_IMPORTS" value="true" />
23
- </TypeScriptCodeStyleSettings>
24
- <VueCodeStyleSettings>
25
- <option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
26
- <option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
27
- </VueCodeStyleSettings>
28
- <codeStyleSettings language="HTML">
29
- <option name="SOFT_MARGINS" value="80" />
30
- <indentOptions>
31
- <option name="INDENT_SIZE" value="2" />
32
- <option name="CONTINUATION_INDENT_SIZE" value="2" />
33
- <option name="TAB_SIZE" value="2" />
34
- </indentOptions>
35
- </codeStyleSettings>
36
- <codeStyleSettings language="JavaScript">
37
- <option name="SOFT_MARGINS" value="80" />
38
- <indentOptions>
39
- <option name="INDENT_SIZE" value="2" />
40
- <option name="CONTINUATION_INDENT_SIZE" value="2" />
41
- <option name="TAB_SIZE" value="2" />
42
- </indentOptions>
43
- </codeStyleSettings>
44
- <codeStyleSettings language="TypeScript">
45
- <option name="SOFT_MARGINS" value="80" />
46
- <indentOptions>
47
- <option name="INDENT_SIZE" value="2" />
48
- <option name="CONTINUATION_INDENT_SIZE" value="2" />
49
- <option name="TAB_SIZE" value="2" />
50
- </indentOptions>
51
- </codeStyleSettings>
52
- <codeStyleSettings language="Vue">
53
- <option name="SOFT_MARGINS" value="80" />
54
- <indentOptions>
55
- <option name="CONTINUATION_INDENT_SIZE" value="2" />
56
- </indentOptions>
57
- </codeStyleSettings>
58
- </code_scheme>
59
- </component>
@@ -1,5 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <state>
3
- <option name="USE_PER_PROJECT_SETTINGS" value="true" />
4
- </state>
5
- </component>
@@ -1,6 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
- </profile>
6
- </component>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/250218_nodejs_core.iml" filepath="$PROJECT_DIR$/.idea/250218_nodejs_core.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="PrettierConfiguration">
4
- <option name="myConfigurationMode" value="AUTOMATIC" />
5
- </component>
6
- </project>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="" vcs="Git" />
5
- </component>
6
- </project>