hola-server 0.3.21 → 0.3.23

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
@@ -122,8 +122,16 @@ const validate_fields = (meta, fields) => {
122
122
  if (!link_entity_field) {
123
123
  throw new Error("link field [" + JSON.stringify(field) + "] should link to one field defined in meta:" + entity.collection);
124
124
  }
125
+
125
126
  //set type to link field type
126
127
  field.type = link_entity_field.type;
128
+ field.required = false;
129
+ field.create = false;
130
+ field.search = false;
131
+ field.update = false;
132
+ field.clone = false;
133
+ field.delete = "cascade";
134
+
127
135
  if (link_entity_field.ref) {
128
136
  field.ref = link_entity_field.ref;
129
137
  }
package/db/entity.js CHANGED
@@ -184,10 +184,11 @@ class Entity {
184
184
  const link_fields = [];
185
185
 
186
186
  const attrs = {};
187
+ const fields_map = this.meta.fields_map;
187
188
  attr_names.split(",").forEach((attr) => {
188
189
  if (list_field_names.includes(attr)) {
189
190
  attrs[attr] = 1;
190
- const field = this.meta.fields_map[attr];
191
+ const field = fields_map[attr];
191
192
  if (field.link) {
192
193
  link_fields.push(field);
193
194
  attrs[field.link] = 1;
@@ -549,7 +550,7 @@ class Entity {
549
550
 
550
551
  const field_names = this.meta.property_fields.map(f => f.name);
551
552
  const attrs = {};
552
- attr_names.split(",").forEach(function (attr) {
553
+ attr_names.split(",").forEach((attr) => {
553
554
  if (field_names.includes(attr)) {
554
555
  attrs[attr] = 1;
555
556
  }
@@ -593,10 +594,12 @@ class Entity {
593
594
  const ref_fields = [];
594
595
  const link_fields = [];
595
596
  const attrs = {};
596
- attr_names.split(",").forEach(function (attr) {
597
+
598
+ const fields_map = this.meta.fields_map;
599
+ attr_names.split(",").forEach((attr) => {
597
600
  if (field_names.includes(attr)) {
598
601
  attrs[attr] = 1;
599
- const field = this.meta.fields_map[attr];
602
+ const field = fields_map[attr];
600
603
  if (field.link) {
601
604
  link_fields.push(field);
602
605
  attrs[field.link] = 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hola-server",
3
- "version": "0.3.21",
3
+ "version": "0.3.23",
4
4
  "description": "a meta programming framework used to build nodejs restful api",
5
5
  "main": "index.js",
6
6
  "scripts": {