c2-mongoose 2.1.279 → 2.1.280
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/SearcherFlow.js +19 -17
- package/package.json +1 -1
- package/src/flow/SearcherFlow.ts +21 -19
|
@@ -357,23 +357,25 @@ var SearcherFlow = /** @class */ (function () {
|
|
|
357
357
|
}
|
|
358
358
|
if (filters.$and.length === 0)
|
|
359
359
|
delete filters['$and'];
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
value
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
value
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
value
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
360
|
+
if (objectSearch === null || objectSearch === void 0 ? void 0 : objectSearch.or) {
|
|
361
|
+
Object.entries(objectSearch === null || objectSearch === void 0 ? void 0 : objectSearch.or).forEach(function (_a) {
|
|
362
|
+
var key = _a[0], value = _a[1];
|
|
363
|
+
console.log(key, value);
|
|
364
|
+
if ((0, Utils_1.isEmpty)(value))
|
|
365
|
+
return;
|
|
366
|
+
if (typeof value === 'string' && _this.isValidObjectId(value) && key !== 'owner') {
|
|
367
|
+
value = new mongoose_1.Types.ObjectId(value);
|
|
368
|
+
}
|
|
369
|
+
if (value === 'true') {
|
|
370
|
+
value = true;
|
|
371
|
+
}
|
|
372
|
+
if (value === 'false') {
|
|
373
|
+
value = false;
|
|
374
|
+
}
|
|
375
|
+
var condition = _this.buildCondition(key, value);
|
|
376
|
+
filters.$or.push(condition);
|
|
377
|
+
});
|
|
378
|
+
}
|
|
377
379
|
return filters;
|
|
378
380
|
};
|
|
379
381
|
SearcherFlow.prototype.isValidObjectId = function (value) {
|
package/package.json
CHANGED
package/src/flow/SearcherFlow.ts
CHANGED
|
@@ -343,26 +343,28 @@ class SearcherFlow<D> {
|
|
|
343
343
|
if (filters.$and.length === 0)
|
|
344
344
|
delete filters['$and']
|
|
345
345
|
|
|
346
|
+
if (objectSearch?.or) {
|
|
347
|
+
Object.entries(objectSearch?.or).forEach(([key, value]) => {
|
|
348
|
+
console.log(key, value)
|
|
349
|
+
if (isEmpty(value)) return
|
|
350
|
+
|
|
351
|
+
if (typeof value === 'string' && this.isValidObjectId(value as string) && key !== 'owner') {
|
|
352
|
+
value = new Types.ObjectId(value as string)
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (value === 'true') {
|
|
356
|
+
value = true
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (value === 'false') {
|
|
360
|
+
value = false
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
const condition = this.buildCondition(key, value)
|
|
364
|
+
filters.$or.push(condition)
|
|
365
|
+
})
|
|
366
|
+
}
|
|
346
367
|
|
|
347
|
-
Object.entries(objectSearch?.or).forEach(([key, value]) => {
|
|
348
|
-
console.log(key, value)
|
|
349
|
-
if (isEmpty(value)) return
|
|
350
|
-
|
|
351
|
-
if (typeof value === 'string' && this.isValidObjectId(value as string) && key !== 'owner') {
|
|
352
|
-
value = new Types.ObjectId(value as string)
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
if (value === 'true') {
|
|
356
|
-
value = true
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
if (value === 'false') {
|
|
360
|
-
value = false
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
const condition = this.buildCondition(key, value)
|
|
364
|
-
filters.$or.push(condition)
|
|
365
|
-
})
|
|
366
368
|
|
|
367
369
|
return filters
|
|
368
370
|
}
|