yaml-admin-api 0.0.78 → 0.0.80

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": "yaml-admin-api",
3
- "version": "0.0.78",
3
+ "version": "0.0.80",
4
4
  "license": "MIT",
5
5
  "description": "YAML Admin API package",
6
6
  "type": "commonjs",
@@ -291,7 +291,12 @@ const generateChartApi = async (app, db, yml, api_prefix) => {
291
291
 
292
292
  let filter = {};
293
293
  chart.filter?.forEach(s => {
294
- let value = req.query[s.name];
294
+ let value = s.value;
295
+ if(value?.startsWith('$')) {
296
+ let q_value = value.substring(1);
297
+ value = req.query[q_value]
298
+ }
299
+
295
300
  if(value == 'null')
296
301
  filter[s.name] = null;
297
302
  else if(value == 'not null')
@@ -121,6 +121,20 @@ const generateCrud = async ({ app, db, entity_name, yml_entity, yml, options })
121
121
  return { $ne: null }
122
122
  else if(value == 'null')
123
123
  return null
124
+ if(value?.startsWith('$')) {
125
+ const [op, val] = value.split(' ')
126
+ if(op == '$lte')
127
+ return { $lte: parseFloat(val) }
128
+ else if(op == '$gte')
129
+ return { $gte: val }
130
+ else if(op == '$lt')
131
+ return { $lt: val }
132
+ else if(op == '$gt')
133
+ return { $gt: val }
134
+ else
135
+ return value
136
+ }
137
+
124
138
  if (type == 'boolean') {
125
139
  if(value == 'true')
126
140
  return true