rez_core 3.1.15 → 3.1.18
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/dist/module/filter/entity/saved-filter-detail.entity.d.ts +1 -0
- package/dist/module/filter/entity/saved-filter-detail.entity.js +4 -0
- package/dist/module/filter/entity/saved-filter-detail.entity.js.map +1 -1
- package/dist/module/filter/repository/saved-filter.repository.js +1 -0
- package/dist/module/filter/repository/saved-filter.repository.js.map +1 -1
- package/dist/module/filter/service/filter.service.js +13 -6
- package/dist/module/filter/service/filter.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/filter/entity/saved-filter-detail.entity.ts +3 -0
- package/src/module/filter/repository/saved-filter.repository.ts +1 -0
- package/src/module/filter/service/filter.service.ts +17 -10
package/package.json
CHANGED
|
@@ -112,6 +112,7 @@ export class SavedFilterRepositoryService {
|
|
|
112
112
|
filter_attribute_name: detail.filter_attribute_name,
|
|
113
113
|
filter_entity_name: detail.filter_entity_name,
|
|
114
114
|
filter_entity_type: detail.filter_entity_type,
|
|
115
|
+
datasource_list: detail.datasource_list,
|
|
115
116
|
filter_value:
|
|
116
117
|
detail.data_type === 'multiselect'
|
|
117
118
|
? detail.filter_value?.trim() === ''
|
|
@@ -92,7 +92,7 @@ export class FilterService {
|
|
|
92
92
|
...savedFilters,
|
|
93
93
|
].filter((f) => f.filter_value !== '');
|
|
94
94
|
|
|
95
|
-
console.log(allFilters,
|
|
95
|
+
console.log(allFilters, 'STEP 1: ALL FILTERS');
|
|
96
96
|
|
|
97
97
|
// 🔹 Step 2: Group filters by filter_entity_type
|
|
98
98
|
const grouped = allFilters.reduce(
|
|
@@ -104,14 +104,14 @@ export class FilterService {
|
|
|
104
104
|
{} as Record<string, any[]>,
|
|
105
105
|
);
|
|
106
106
|
|
|
107
|
-
console.log(grouped,
|
|
107
|
+
console.log(grouped, 'STEP 2: GROUPED FILTERS BY ENTITY TYPE');
|
|
108
108
|
|
|
109
109
|
// 🔹 Step 3: Handle sub-entities first
|
|
110
110
|
let intersectionIds: number[] | null = null;
|
|
111
111
|
for (const [subEntityType, filters] of Object.entries(grouped)) {
|
|
112
112
|
if (subEntityType === entity_type) continue; // skip main entity for now
|
|
113
113
|
|
|
114
|
-
let { queryParams,tabs, ...newDto } = dto;
|
|
114
|
+
let { queryParams, tabs, ...newDto } = dto;
|
|
115
115
|
|
|
116
116
|
const subDto: FilterRequestDto = {
|
|
117
117
|
...newDto,
|
|
@@ -132,12 +132,11 @@ export class FilterService {
|
|
|
132
132
|
data: { entity_tabs: [], entity_list: [], pagination: {} },
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
|
-
|
|
136
135
|
|
|
137
136
|
const relatedIds = await this.entityRelationService.getRelatedEntityIds(
|
|
138
137
|
entity_type,
|
|
139
|
-
subEntityType,
|
|
140
|
-
subEntityIds,
|
|
138
|
+
subEntityType,
|
|
139
|
+
subEntityIds,
|
|
141
140
|
dto.loggedInUser.organization_id,
|
|
142
141
|
);
|
|
143
142
|
|
|
@@ -156,20 +155,25 @@ export class FilterService {
|
|
|
156
155
|
}
|
|
157
156
|
}
|
|
158
157
|
|
|
159
|
-
console.log(intersectionIds,
|
|
158
|
+
console.log(intersectionIds, 'STEP 3: INTERSECTION IDS FOR MAIN ENTITY');
|
|
160
159
|
|
|
161
160
|
// 🔹 Step 4: Call applyFilter for main entity
|
|
162
161
|
const mainFilters = grouped[entity_type] || [];
|
|
163
162
|
const mainDto: FilterRequestDto = {
|
|
164
163
|
...dto,
|
|
165
|
-
quickFilter: mainFilters,
|
|
164
|
+
quickFilter: [...mainFilters], // this guarantees it's an array
|
|
166
165
|
savedFilterCode: null,
|
|
167
166
|
attributeFilter: [],
|
|
168
167
|
};
|
|
169
168
|
|
|
170
169
|
// pass intersection ids as an extra constraint
|
|
171
170
|
if (intersectionIds && intersectionIds.length > 0) {
|
|
172
|
-
mainDto[
|
|
171
|
+
(mainDto.quickFilter ??= []).push({
|
|
172
|
+
filter_attribute: 'id',
|
|
173
|
+
filter_operator: 'equal',
|
|
174
|
+
filter_value: intersectionIds,
|
|
175
|
+
filter_entity_type: entity_type,
|
|
176
|
+
});
|
|
173
177
|
}
|
|
174
178
|
|
|
175
179
|
return this.applyFilter(mainDto);
|
|
@@ -229,6 +233,8 @@ export class FilterService {
|
|
|
229
233
|
loggedInUser,
|
|
230
234
|
);
|
|
231
235
|
|
|
236
|
+
console.log(getAttributeColumnMeta, 'ATTRIBUTE META FOR ENTITY');
|
|
237
|
+
|
|
232
238
|
const attributeMetaMap = getAttributeColumnMeta.reduce(
|
|
233
239
|
(acc, attr) => {
|
|
234
240
|
acc[attr.attribute_key] = attr;
|
|
@@ -261,7 +267,7 @@ export class FilterService {
|
|
|
261
267
|
),
|
|
262
268
|
];
|
|
263
269
|
|
|
264
|
-
console.log(baseFilters,
|
|
270
|
+
console.log(baseFilters, 'STEP 1B: BASE FILTERS FOR MAIN ENTITY');
|
|
265
271
|
|
|
266
272
|
// Build where clauses
|
|
267
273
|
const baseWhere = this.buildWhereClauses(baseFilters, attributeMetaMap);
|
|
@@ -638,6 +644,7 @@ export class FilterService {
|
|
|
638
644
|
filter: any,
|
|
639
645
|
meta: any,
|
|
640
646
|
): { query: string; params: any } | null {
|
|
647
|
+
console.log(filter, meta, 'FILTER AND META');
|
|
641
648
|
if (!meta) return null;
|
|
642
649
|
|
|
643
650
|
let attr = filter.filter_attribute;
|