c2-mongoose 2.1.317 → 2.1.319

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.
@@ -236,6 +236,16 @@ var SearcherFlow = /** @class */ (function () {
236
236
  condition[fieldName] = __assign(__assign({}, condition[fieldName]), { $lte: momentValue.tz('America/Sao_Paulo', false).toDate() });
237
237
  }
238
238
  }
239
+ else if (key.endsWith('Range')) {
240
+ var fieldName = key.replace('Range', '');
241
+ var values = value;
242
+ if ((0, Utils_1.isNotEmpty)(values[0])) {
243
+ condition[fieldName] = __assign(__assign({}, condition[fieldName]), { $gte: values[0] });
244
+ }
245
+ if ((0, Utils_1.isNotEmpty)(values[1])) {
246
+ condition[fieldName] = __assign(__assign({}, condition[fieldName]), { $lte: values[1] });
247
+ }
248
+ }
239
249
  else if (key.endsWith('Like')) {
240
250
  var fieldName = key.replace('Like', '');
241
251
  condition[fieldName] = this.buildRegex(value); //{ $regex: value as any, $options: 'i' }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.317",
3
+ "version": "2.1.319",
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",
@@ -213,6 +213,22 @@ class SearcherFlow<D> {
213
213
  $lte: momentValue.tz('America/Sao_Paulo', false).toDate()
214
214
  }
215
215
  }
216
+ } else if (key.endsWith('Range')) {
217
+ var fieldName = key.replace('Range', '')
218
+ var values = value as any
219
+ if (isNotEmpty(values[0])) {
220
+ condition[fieldName] = {
221
+ ...condition[fieldName],
222
+ $gte: values[0]
223
+ }
224
+ }
225
+
226
+ if (isNotEmpty(values[1])) {
227
+ condition[fieldName] = {
228
+ ...condition[fieldName],
229
+ $lte: values[1]
230
+ }
231
+ }
216
232
  } else if (key.endsWith('Like')) {
217
233
  var fieldName = key.replace('Like', '')
218
234
  condition[fieldName] = this.buildRegex(value as string) //{ $regex: value as any, $options: 'i' }