hola-server 1.0.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/db/entity.js +5 -2
  2. package/package.json +1 -1
package/db/entity.js CHANGED
@@ -1066,13 +1066,16 @@ class Entity {
1066
1066
  query[this.meta.user_field] = get_session_userid();
1067
1067
  }
1068
1068
 
1069
+ const search_fields = this.meta.search_fields;
1069
1070
  //client query: key:value, key:value
1070
- if (client_query && client_query.trim().length > 0) {
1071
+ if (client_query && client_query.trim().length > 0 && search_fields && search_fields.length > 0) {
1071
1072
  const queries = client_query.split(",");
1072
1073
  for (let i = 0; i < queries.length; i++) {
1073
1074
  const query_values = queries[i].split(":");
1074
1075
  if (query_values && query_values.length == 2) {
1075
- query[query_values[0]] = query_values[1];
1076
+ const field_name = query_values[0];
1077
+ const [search_field] = search_fields.filter(f => f.name == field_name);
1078
+ search_field && (query[field_name] = parse_search_value(field_name, search_field.type, query_values[1]))
1076
1079
  }
1077
1080
  }
1078
1081
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hola-server",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "a meta programming framework used to build nodejs restful api",
5
5
  "main": "index.js",
6
6
  "scripts": {