c2-mongoose 2.1.10 → 2.1.12
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/flow/SearchFlow.js +14 -6
- package/package.json +1 -1
- package/src/flow/SearchFlow.ts +14 -6
package/dist/flow/SearchFlow.js
CHANGED
|
@@ -237,11 +237,11 @@ var SearchFlow = /** @class */ (function () {
|
|
|
237
237
|
};
|
|
238
238
|
SearchFlow.prototype.buildDefaultFilters = function (objectSearch) {
|
|
239
239
|
var filters = { $and: [] };
|
|
240
|
-
Object.entries(objectSearch).forEach(function (_a) {
|
|
240
|
+
Object.entries(objectSearch.model).forEach(function (_a) {
|
|
241
241
|
var key = _a[0], value = _a[1];
|
|
242
242
|
if ((0, Utils_1.isNotEmpty)(value)) {
|
|
243
243
|
var condition = {};
|
|
244
|
-
if (['order', 'orderBy', 'properties', 'populate', 'page', 'limit', 'model', 'searchText'].includes(key)) {
|
|
244
|
+
if (['order', 'orderBy', 'properties', 'populate', 'page', 'limit', 'model', 'select', 'searchText', 'isPageable', 'searchPageable'].includes(key)) {
|
|
245
245
|
return;
|
|
246
246
|
}
|
|
247
247
|
if (key.endsWith('DateRange')) {
|
|
@@ -256,7 +256,6 @@ var SearchFlow = /** @class */ (function () {
|
|
|
256
256
|
filters.$and.push(condition);
|
|
257
257
|
}
|
|
258
258
|
else if (key.endsWith('Like')) {
|
|
259
|
-
console.log(key);
|
|
260
259
|
var keyAux = key.replace('Like', '');
|
|
261
260
|
condition[keyAux] = { $regex: value, $options: 'i' };
|
|
262
261
|
filters.$and.push(condition);
|
|
@@ -272,9 +271,9 @@ var SearchFlow = /** @class */ (function () {
|
|
|
272
271
|
}
|
|
273
272
|
}
|
|
274
273
|
});
|
|
275
|
-
if (
|
|
276
|
-
|
|
277
|
-
}
|
|
274
|
+
// if (isNotEmpty(objectSearch.model)) {
|
|
275
|
+
// this.addFilterModel(objectSearch.model, filters)
|
|
276
|
+
// }
|
|
278
277
|
if (filters.$and.length === 0)
|
|
279
278
|
delete filters['$and'];
|
|
280
279
|
return filters;
|
|
@@ -282,6 +281,15 @@ var SearchFlow = /** @class */ (function () {
|
|
|
282
281
|
SearchFlow.prototype.addFilterModel = function (model, filters) {
|
|
283
282
|
Object.entries(model).forEach(function (_a) {
|
|
284
283
|
var key = _a[0], value = _a[1];
|
|
284
|
+
if (key.endsWith('DateRange')) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (key.endsWith('Like')) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (['order', 'orderBy', 'properties', 'populate', 'page', 'limit', 'model', 'select', 'searchText', 'isPageable', 'searchPageable'].includes(key)) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
285
293
|
if ((0, Utils_1.isNotEmpty)(value)) {
|
|
286
294
|
var condition = {};
|
|
287
295
|
condition[key] = value;
|
package/package.json
CHANGED
package/src/flow/SearchFlow.ts
CHANGED
|
@@ -162,10 +162,10 @@ abstract class SearchFlow {
|
|
|
162
162
|
|
|
163
163
|
public buildDefaultFilters(objectSearch: any) {
|
|
164
164
|
let filters = { $and: [] } as any
|
|
165
|
-
Object.entries(objectSearch).forEach(([key, value]) => {
|
|
165
|
+
Object.entries(objectSearch.model).forEach(([key, value]) => {
|
|
166
166
|
if (isNotEmpty(value)) {
|
|
167
167
|
let condition = {} as any
|
|
168
|
-
if (['order', 'orderBy', 'properties', 'populate', 'page', 'limit', 'model', 'searchText'].includes(key)) {
|
|
168
|
+
if (['order', 'orderBy', 'properties', 'populate', 'page', 'limit', 'model', 'select', 'searchText', 'isPageable', 'searchPageable'].includes(key)) {
|
|
169
169
|
return
|
|
170
170
|
}
|
|
171
171
|
|
|
@@ -187,7 +187,6 @@ abstract class SearchFlow {
|
|
|
187
187
|
}
|
|
188
188
|
filters.$and.push(condition)
|
|
189
189
|
} else if (key.endsWith('Like')) {
|
|
190
|
-
console.log(key)
|
|
191
190
|
var keyAux = key.replace('Like', '')
|
|
192
191
|
condition[keyAux] = { $regex: value as any, $options: 'i' }
|
|
193
192
|
filters.$and.push(condition)
|
|
@@ -203,9 +202,9 @@ abstract class SearchFlow {
|
|
|
203
202
|
})
|
|
204
203
|
|
|
205
204
|
|
|
206
|
-
if (isNotEmpty(objectSearch.model)) {
|
|
207
|
-
|
|
208
|
-
}
|
|
205
|
+
// if (isNotEmpty(objectSearch.model)) {
|
|
206
|
+
// this.addFilterModel(objectSearch.model, filters)
|
|
207
|
+
// }
|
|
209
208
|
|
|
210
209
|
if (filters.$and.length === 0)
|
|
211
210
|
delete filters['$and']
|
|
@@ -215,6 +214,15 @@ abstract class SearchFlow {
|
|
|
215
214
|
|
|
216
215
|
public addFilterModel(model: any, filters: any) {
|
|
217
216
|
Object.entries(model).forEach(([key, value]) => {
|
|
217
|
+
if (key.endsWith('DateRange')) {
|
|
218
|
+
return
|
|
219
|
+
}
|
|
220
|
+
if (key.endsWith('Like')) {
|
|
221
|
+
return
|
|
222
|
+
}
|
|
223
|
+
if (['order', 'orderBy', 'properties', 'populate', 'page', 'limit', 'model', 'select', 'searchText', 'isPageable', 'searchPageable'].includes(key)) {
|
|
224
|
+
return
|
|
225
|
+
}
|
|
218
226
|
if (isNotEmpty(value)) {
|
|
219
227
|
let condition = {} as any
|
|
220
228
|
condition[key] = value
|