hola-server 0.3.20 → 0.3.21
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 +4 -1
- package/db/entity.js +7 -7
- package/package.json +1 -1
package/core/meta.js
CHANGED
|
@@ -48,7 +48,7 @@ const validate_field = (meta, field) => {
|
|
|
48
48
|
field.required = true;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
if (field.ref) {
|
|
51
|
+
if (field.ref && !field.link) {
|
|
52
52
|
const ref_meta = meta_manager[field.ref];
|
|
53
53
|
if (!ref_meta) {
|
|
54
54
|
throw new Error("meta:" + meta.collection + ",field:" + field.name + " refers invalid meta:" + field.ref + "]");
|
|
@@ -124,6 +124,9 @@ const validate_fields = (meta, fields) => {
|
|
|
124
124
|
}
|
|
125
125
|
//set type to link field type
|
|
126
126
|
field.type = link_entity_field.type;
|
|
127
|
+
if (link_entity_field.ref) {
|
|
128
|
+
field.ref = link_entity_field.ref;
|
|
129
|
+
}
|
|
127
130
|
}
|
|
128
131
|
}
|
|
129
132
|
});
|
package/db/entity.js
CHANGED
|
@@ -188,11 +188,11 @@ class Entity {
|
|
|
188
188
|
if (list_field_names.includes(attr)) {
|
|
189
189
|
attrs[attr] = 1;
|
|
190
190
|
const field = this.meta.fields_map[attr];
|
|
191
|
-
if (field.
|
|
192
|
-
ref_fields.push(field);
|
|
193
|
-
} else if (field.link) {
|
|
191
|
+
if (field.link) {
|
|
194
192
|
link_fields.push(field);
|
|
195
193
|
attrs[field.link] = 1;
|
|
194
|
+
} else if (field.ref) {
|
|
195
|
+
ref_fields.push(field);
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
});
|
|
@@ -597,11 +597,11 @@ class Entity {
|
|
|
597
597
|
if (field_names.includes(attr)) {
|
|
598
598
|
attrs[attr] = 1;
|
|
599
599
|
const field = this.meta.fields_map[attr];
|
|
600
|
-
if (field.
|
|
601
|
-
ref_fields.push(field);
|
|
602
|
-
} else if (field.link) {
|
|
600
|
+
if (field.link) {
|
|
603
601
|
link_fields.push(field);
|
|
604
602
|
attrs[field.link] = 1;
|
|
603
|
+
} else if (field.ref) {
|
|
604
|
+
ref_fields.push(field);
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
607
|
});
|
|
@@ -987,7 +987,7 @@ class Entity {
|
|
|
987
987
|
attr_fields.forEach((attr) => {
|
|
988
988
|
attrs[attr] = 1;
|
|
989
989
|
const field = meta.fields_map[attr];
|
|
990
|
-
if (field.ref) {
|
|
990
|
+
if (!field.link && field.ref) {
|
|
991
991
|
ref_fields.push(field);
|
|
992
992
|
}
|
|
993
993
|
});
|