c2-mongoose 2.0.6 → 2.0.7

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.
@@ -253,6 +253,12 @@ var SearchFlow = /** @class */ (function () {
253
253
  if ((0, Utils_1.isNotEmpty)(values[1])) {
254
254
  condition[keyAux] = __assign(__assign({}, condition[keyAux]), { $lte: new Date(values[1]) });
255
255
  }
256
+ filters.$and.push(condition);
257
+ }
258
+ else if (key.endsWith('Like')) {
259
+ var keyAux = key.replace('Like', '');
260
+ condition[keyAux] = { $regex: value, $options: 'i' };
261
+ filters.$and.push(condition);
256
262
  }
257
263
  else {
258
264
  if (!Array.isArray(value)) {
@@ -261,8 +267,6 @@ var SearchFlow = /** @class */ (function () {
261
267
  else {
262
268
  condition[key] = { $in: value };
263
269
  }
264
- }
265
- if ((0, Utils_1.isNotEmpty)(condition)) {
266
270
  filters.$and.push(condition);
267
271
  }
268
272
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "Lib to make any search in database mongoose and use as basic crud",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -183,15 +183,17 @@ abstract class SearchFlow {
183
183
  $lte: new Date(values[1])
184
184
  }
185
185
  }
186
+ filters.$and.push(condition)
187
+ } else if (key.endsWith('Like')) {
188
+ var keyAux = key.replace('Like', '')
189
+ condition[keyAux] = {$regex: value as any, $options: 'i'}
190
+ filters.$and.push(condition)
186
191
  } else {
187
192
  if (!Array.isArray(value)) {
188
193
  condition[key] = value
189
194
  } else {
190
195
  condition[key] = { $in: value }
191
196
  }
192
- }
193
-
194
- if (isNotEmpty(condition)) {
195
197
  filters.$and.push(condition)
196
198
  }
197
199
  }