hola-server 0.6.12 → 0.6.14

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/core/meta.js CHANGED
@@ -91,7 +91,7 @@ const validate_field = (meta, field) => {
91
91
  });
92
92
  }
93
93
 
94
- const editable = field.create || field.update;
94
+ const editable = (field.create != false) || (field.update != false);
95
95
 
96
96
  if (field.view) {
97
97
  if (!editable) {
package/db/entity.js CHANGED
@@ -239,7 +239,7 @@ class Entity {
239
239
  * @returns object with code and err
240
240
  */
241
241
  async create_entity(param_obj, view) {
242
- const fields = this.meta.create_fields.filter(field => field.view == view);
242
+ const fields = view == "*" ? this.meta.create_fields : this.meta.create_fields.filter(field => field.view == view);
243
243
  const { obj, error_field_names } = convert_type(param_obj, fields);
244
244
  if (error_field_names.length > 0) {
245
245
  if (is_log_error()) {
@@ -402,7 +402,7 @@ class Entity {
402
402
  *
403
403
  */
404
404
  async update_entity(_id, param_obj, view) {
405
- const fields = this.meta.update_fields.filter(field => field.view == view);
405
+ const fields = view == "*" ? this.meta.update_fields : this.meta.update_fields.filter(field => field.view == view);
406
406
 
407
407
  const { obj, error_field_names } = convert_update_type(param_obj, fields);
408
408
  if (error_field_names.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hola-server",
3
- "version": "0.6.12",
3
+ "version": "0.6.14",
4
4
  "description": "a meta programming framework used to build nodejs restful api",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/router/create.js CHANGED
@@ -29,7 +29,7 @@ const init_create_router = function (router, meta) {
29
29
  //which view to create the entity
30
30
  let { _view } = post_params(req, ["_view"]);
31
31
  if (!_view) {
32
- _view = "0";
32
+ _view = "*";
33
33
  }
34
34
 
35
35
  const param_obj = post_params(req, meta.field_names);
package/router/update.js CHANGED
@@ -39,7 +39,7 @@ const init_update_router = function (router, meta) {
39
39
  //which view to update the entity
40
40
  let { _view } = post_params(req, ["_view"]);
41
41
  if (!_view) {
42
- _view = "0";
42
+ _view = "*";
43
43
  }
44
44
 
45
45
  const param_obj = post_update_params(req, meta.field_names);