rez_core 4.0.227 → 4.0.232

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.232",
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,34 @@ 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 sourceKey = linkAttr.applicable_attribute_key; // source column = middle_name
219
+ const targetKey = linkAttr.attribute_key; // final JSON key = father_middle_name
220
+
221
+ if (!childEntityType || !sourceKey || !targetKey) continue;
222
+
223
+ // value must be taken from applicable_attribute_key
224
+ const mappingValue = mainData?.[sourceKey] ?? null;
225
+
226
+ const value = await this.applyLinkedFilterUsingSavedFilter(
227
+ childEntityType,
228
+ linkAttr.fla_saved_filter_code,
229
+ sourceKey,
230
+ mappingValue,
231
+ targetKey, // IMPORTANT → write to father_middle_name
232
+ loggedInUser,
233
+ entityId
234
+ );
235
+
236
+ if (value !== null && value !== undefined) {
237
+ const flatKey = targetKey; // do NOT use childAttributeKey
238
+ flatJson[flatKey] = value;
239
+ }
240
+ }
241
+
242
+
235
243
  // 6. Save JSON
236
244
  await this.dataSource.query(
237
245
  `INSERT INTO frm_entity_json (entity_type, entity_id, json_data, created_by)
@@ -307,7 +315,7 @@ export class EntityJSONService extends EntityServiceImpl {
307
315
  {
308
316
  filter_attribute: 'parent_id',
309
317
  filter_operator: 'equal',
310
- filter_value: entity_id,
318
+ filter_value: [entity_id],
311
319
  },
312
320
  ];
313
321