hola-server 1.0.2 → 1.0.3

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 +3 -2
  2. package/package.json +1 -1
package/db/entity.js CHANGED
@@ -1067,6 +1067,7 @@ class Entity {
1067
1067
  }
1068
1068
 
1069
1069
  const search_fields = this.meta.search_fields;
1070
+ let search_query = {};
1070
1071
  //client query: key:value, key:value
1071
1072
  if (client_query && client_query.trim().length > 0 && search_fields && search_fields.length > 0) {
1072
1073
  const queries = client_query.split(",");
@@ -1075,7 +1076,7 @@ class Entity {
1075
1076
  if (query_values && query_values.length == 2) {
1076
1077
  const field_name = query_values[0];
1077
1078
  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]))
1079
+ search_field && (search_query = parse_search_value(field_name, search_field.type, query_values[1]))
1079
1080
  }
1080
1081
  }
1081
1082
  }
@@ -1087,7 +1088,7 @@ class Entity {
1087
1088
  query = { ...query, ...this.meta.ref_filter["*"] };
1088
1089
  }
1089
1090
  }
1090
- return this.find_sort(query, { [this.meta.ref_label]: 1 }, { [this.meta.ref_label]: 1 });
1091
+ return this.find_sort({ ...search_query, ...query }, { [this.meta.ref_label]: 1 }, { [this.meta.ref_label]: 1 });
1091
1092
  }
1092
1093
 
1093
1094
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hola-server",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "a meta programming framework used to build nodejs restful api",
5
5
  "main": "index.js",
6
6
  "scripts": {