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
|
@@ -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
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
|