@webtypen/webframez-core 0.2.38 → 0.2.40
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.
|
@@ -63,10 +63,11 @@ class DataBuilder {
|
|
|
63
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64
64
|
const out = {};
|
|
65
65
|
for (let key in fields) {
|
|
66
|
-
if (fields[key].type === "object") {
|
|
67
|
-
out[key] =
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
if (false && fields[key].type === "object") {
|
|
67
|
+
// out[key] =
|
|
68
|
+
// typeof fields[key].schema === "object" && Object.keys(fields[key].schema).length > 0
|
|
69
|
+
// ? { ...(await this.getFieldsFrontend(fields[key].schema, payload)) }
|
|
70
|
+
// : fields[key];
|
|
70
71
|
}
|
|
71
72
|
else {
|
|
72
73
|
out[key] =
|
|
@@ -137,12 +138,17 @@ class DataBuilder {
|
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
if (typeof fields[key].schema === "object") {
|
|
140
|
-
if (
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
if (fields[key].type === "array") {
|
|
142
|
+
if (value && value.length > 0) {
|
|
143
|
+
for (let i in value) {
|
|
144
|
+
const entryPath = fieldPath + "[" + i + "]";
|
|
145
|
+
errors = yield this.validateFields(db, type, fields[key].schema, req, errors, entryPath);
|
|
146
|
+
}
|
|
144
147
|
}
|
|
145
148
|
}
|
|
149
|
+
else if (fields[key].type === "object") {
|
|
150
|
+
errors = yield this.validateFields(db, type, fields[key].schema, req, errors, fieldPath);
|
|
151
|
+
}
|
|
146
152
|
}
|
|
147
153
|
if (fields[key].validation && fields[key].validation.trim() !== "") {
|
|
148
154
|
// @ToDo
|
package/package.json
CHANGED
|
@@ -95,11 +95,11 @@ export class DataBuilder {
|
|
|
95
95
|
async getFieldsFrontend(fields: any, payload?: any) {
|
|
96
96
|
const out: any = {};
|
|
97
97
|
for (let key in fields) {
|
|
98
|
-
if (fields[key].type === "object") {
|
|
99
|
-
out[key] =
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
if (false && fields[key].type === "object") {
|
|
99
|
+
// out[key] =
|
|
100
|
+
// typeof fields[key].schema === "object" && Object.keys(fields[key].schema).length > 0
|
|
101
|
+
// ? { ...(await this.getFieldsFrontend(fields[key].schema, payload)) }
|
|
102
|
+
// : fields[key];
|
|
103
103
|
} else {
|
|
104
104
|
out[key] =
|
|
105
105
|
typeof fields[key].schema === "object" && Object.keys(fields[key].schema).length > 0
|
|
@@ -183,11 +183,15 @@ export class DataBuilder {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
if (typeof fields[key].schema === "object") {
|
|
186
|
-
if (
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
186
|
+
if (fields[key].type === "array") {
|
|
187
|
+
if (value && value.length > 0) {
|
|
188
|
+
for (let i in value) {
|
|
189
|
+
const entryPath = fieldPath + "[" + i + "]";
|
|
190
|
+
errors = await this.validateFields(db, type, fields[key].schema, req, errors, entryPath);
|
|
191
|
+
}
|
|
190
192
|
}
|
|
193
|
+
} else if (fields[key].type === "object") {
|
|
194
|
+
errors = await this.validateFields(db, type, fields[key].schema, req, errors, fieldPath);
|
|
191
195
|
}
|
|
192
196
|
}
|
|
193
197
|
|