rez_core 4.0.227 → 4.0.230

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.227",
3
+ "version": "4.0.230",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -103,6 +103,7 @@ export class EntityJSONService extends EntityServiceImpl {
103
103
  'attr.id',
104
104
  'attr.name',
105
105
  'attr.attribute_key',
106
+ 'fla.saved_filter_code',
106
107
  ])
107
108
  .where('attr.organization_id = :orgId', { orgId })
108
109
  .getRawMany();
@@ -211,27 +212,33 @@ export class EntityJSONService extends EntityServiceImpl {
211
212
  }
212
213
 
213
214
  // 5. Merge linked attributes using saved filters
214
- for (const linkAttr of safeAttributes.linkedAttributes) {
215
- if (!linkAttr.applicable_entity_type || !linkAttr.applicable_attribute_key) continue;
216
-
217
- const mappingValue = mainData?.[linkAttr.parent_attribute_key || ''] ?? null;
218
- const value = await this.applyLinkedFilterUsingSavedFilter(
219
- linkAttr.applicable_entity_type,
220
- linkAttr.saved_filter_code,
221
- linkAttr.applicable_attribute_key,
222
- mappingValue,
223
- linkAttr.target_attribute_key || linkAttr.applicable_attribute_key,
224
- loggedInUser,
225
- entityId,
226
- );
227
-
228
- if (value !== null && value !== undefined) {
229
- const flatKey = attrMap[linkAttr.target_attribute_key || linkAttr.applicable_attribute_key]
230
- || (linkAttr.target_attribute_key || linkAttr.applicable_attribute_key);
231
- flatJson[flatKey] = value;
232
- }
233
- }
234
-
215
+ // 5. Merge linked attributes using saved filters
216
+ for (const linkAttr of safeAttributes.linkedAttributes) {
217
+ const childEntityType = linkAttr.fla_applicable_entity_type;
218
+ const childAttributeKey = linkAttr.attr_attribute_key;
219
+
220
+ if (!childEntityType || !childAttributeKey) continue;
221
+
222
+ // mappingValue can come from mainData or relatedData if you have parent key
223
+ const mappingValue = mainData?.[childAttributeKey] ?? null;
224
+
225
+ const value = await this.applyLinkedFilterUsingSavedFilter(
226
+ childEntityType,
227
+ linkAttr.fla_saved_filter_code, // make sure this column exists in your query
228
+ childAttributeKey,
229
+ mappingValue,
230
+ childAttributeKey, // target attribute in flatJson
231
+ loggedInUser,
232
+ entityId
233
+ );
234
+
235
+ if (value !== null && value !== undefined) {
236
+ // Use attrMap if flat_json_key exists
237
+ const flatKey = attrMap[childAttributeKey] || childAttributeKey;
238
+ flatJson[flatKey] = value;
239
+ }
240
+ }
241
+
235
242
  // 6. Save JSON
236
243
  await this.dataSource.query(
237
244
  `INSERT INTO frm_entity_json (entity_type, entity_id, json_data, created_by)
@@ -307,7 +314,7 @@ export class EntityJSONService extends EntityServiceImpl {
307
314
  {
308
315
  filter_attribute: 'parent_id',
309
316
  filter_operator: 'equal',
310
- filter_value: entity_id,
317
+ filter_value: [entity_id],
311
318
  },
312
319
  ];
313
320