@azteam/express 1.2.230 → 1.2.231

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azteam/express",
3
- "version": "1.2.230",
3
+ "version": "1.2.231",
4
4
  "main": "src/index.js",
5
5
  "engines": {
6
6
  "node": ">= 12.0.0",
@@ -56,31 +56,28 @@ export default function (options = {}) {
56
56
  delete req.query.sort_type;
57
57
  delete req.query.page;
58
58
 
59
- for (const key in req.query) {
60
- if (req.query.hasOwnProperty(key)) {
61
- const value = req.query[key];
59
+ _.map(req.query, (value, key) => {
60
+ if (key.endsWith('_start')) {
61
+ const newKey = key.replace('_start', '');
62
62
 
63
- if (key.endsWith('_start')) {
64
- const newKey = key.replace('_start', '');
63
+ req.query[newKey] = {
64
+ ...req.query[newKey],
65
+ $gte: value,
66
+ };
67
+ } else if (key.endsWith('_end')) {
68
+ const newKey = key.replace('_end', '');
65
69
 
66
- req.query[newKey] = {
67
- ...req.query[newKey],
68
- $gte: value,
69
- };
70
- } else if (key.endsWith('_end')) {
71
- const newKey = key.replace('_end', '');
72
-
73
- req.query[newKey] = {
74
- ...req.query[newKey],
75
- $lte: value,
76
- };
77
- }
70
+ req.query[newKey] = {
71
+ ...req.query[newKey],
72
+ $lte: value,
73
+ };
74
+ }
78
75
 
79
- if (!options.searchFields.includes(key)) {
80
- delete req.query[key];
81
- }
76
+ if (!options.searchFields.includes(key)) {
77
+ delete req.query[key];
82
78
  }
83
- }
79
+ });
80
+
84
81
  if (req.query.keywords) {
85
82
  const arrKeywords = _.words(req.query.keywords);
86
83
  const keywords = `"${arrKeywords.join('" "')}"`;