c2-mongoose 2.1.85 → 2.1.87
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
CHANGED
|
@@ -411,6 +411,7 @@ var SearchFlow = /** @class */ (function () {
|
|
|
411
411
|
});
|
|
412
412
|
};
|
|
413
413
|
SearchFlow.prototype.buildDefaultFilters = function (objectSearch) {
|
|
414
|
+
var _this = this;
|
|
414
415
|
var filters = { $and: [] };
|
|
415
416
|
Object.entries(objectSearch.model).forEach(function (_a) {
|
|
416
417
|
var key = _a[0], value = _a[1];
|
|
@@ -419,6 +420,9 @@ var SearchFlow = /** @class */ (function () {
|
|
|
419
420
|
if (['projection', 'pageable', 'order', 'orderBy', 'properties', 'populate', 'page', 'limit', 'model', 'select', 'searchText', 'isPageable', 'searchPageable'].includes(key)) {
|
|
420
421
|
return;
|
|
421
422
|
}
|
|
423
|
+
if (value instanceof mongoose_1.Types.ObjectId) {
|
|
424
|
+
console.log(value, "objectiId");
|
|
425
|
+
}
|
|
422
426
|
if (key.endsWith("_id")) {
|
|
423
427
|
value = new mongoose_1.Types.ObjectId(value);
|
|
424
428
|
}
|
|
@@ -449,7 +453,7 @@ var SearchFlow = /** @class */ (function () {
|
|
|
449
453
|
}
|
|
450
454
|
else if (key.endsWith('Like')) {
|
|
451
455
|
var fieldName = key.replace('Like', '');
|
|
452
|
-
condition[fieldName] = { $regex: value, $options: 'i' }
|
|
456
|
+
condition[fieldName] = _this.buildRegex(value); //{ $regex: value as any, $options: 'i' }
|
|
453
457
|
filters.$and.push(condition);
|
|
454
458
|
}
|
|
455
459
|
else {
|
package/package.json
CHANGED
package/src/flow/SearchFlow.ts
CHANGED
|
@@ -311,6 +311,9 @@ abstract class SearchFlow {
|
|
|
311
311
|
return
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
+
if (value instanceof Types.ObjectId) {
|
|
315
|
+
console.log(value, "objectiId")
|
|
316
|
+
}
|
|
314
317
|
if (key.endsWith("_id")) {
|
|
315
318
|
value = new Types.ObjectId(value as string)
|
|
316
319
|
}
|
|
@@ -350,7 +353,7 @@ abstract class SearchFlow {
|
|
|
350
353
|
filters.$and.push(condition)
|
|
351
354
|
} else if (key.endsWith('Like')) {
|
|
352
355
|
var fieldName = key.replace('Like', '')
|
|
353
|
-
condition[fieldName] = { $regex: value as any, $options: 'i' }
|
|
356
|
+
condition[fieldName] = this.buildRegex(value as string) //{ $regex: value as any, $options: 'i' }
|
|
354
357
|
filters.$and.push(condition)
|
|
355
358
|
} else {
|
|
356
359
|
if (!Array.isArray(value)) {
|