rez_core 4.0.216 → 4.0.218
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
|
@@ -211,27 +211,33 @@ export class EntityJSONService extends EntityServiceImpl {
|
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
// 5. Merge linked attributes using saved filters
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
214
|
+
// 5. Merge linked attributes using saved filters
|
|
215
|
+
for (const linkAttr of safeAttributes.linkedAttributes) {
|
|
216
|
+
const childEntityType = linkAttr.fla_applicable_entity_type;
|
|
217
|
+
const childAttributeKey = linkAttr.attr_attribute_key;
|
|
218
|
+
|
|
219
|
+
if (!childEntityType || !childAttributeKey) continue;
|
|
220
|
+
|
|
221
|
+
// mappingValue can come from mainData or relatedData if you have parent key
|
|
222
|
+
const mappingValue = mainData?.[childAttributeKey] ?? null;
|
|
223
|
+
|
|
224
|
+
const value = await this.applyLinkedFilterUsingSavedFilter(
|
|
225
|
+
childEntityType,
|
|
226
|
+
linkAttr.saved_filter_code, // make sure this column exists in your query
|
|
227
|
+
childAttributeKey,
|
|
228
|
+
mappingValue,
|
|
229
|
+
childAttributeKey, // target attribute in flatJson
|
|
230
|
+
loggedInUser,
|
|
231
|
+
entityId
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
if (value !== null && value !== undefined) {
|
|
235
|
+
// Use attrMap if flat_json_key exists
|
|
236
|
+
const flatKey = attrMap[childAttributeKey] || childAttributeKey;
|
|
237
|
+
flatJson[flatKey] = value;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
235
241
|
// 6. Save JSON
|
|
236
242
|
await this.dataSource.query(
|
|
237
243
|
`INSERT INTO frm_entity_json (entity_type, entity_id, json_data, created_by)
|