@webtypen/webframez-core 0.2.31 → 0.2.32
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.
|
@@ -216,7 +216,15 @@ class DataBuilder {
|
|
|
216
216
|
}
|
|
217
217
|
else {
|
|
218
218
|
let elementVal = null;
|
|
219
|
-
if (
|
|
219
|
+
if (fields[key].type === "ObjectId") {
|
|
220
|
+
if (value && (value.toString().length === 12 || value.toString().length === 24)) {
|
|
221
|
+
elementVal = typeof value === "string" ? yield Model_1.Model.objectId(value) : value;
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
elementVal = yield Model_1.Model.objectId();
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
else if (value !== undefined &&
|
|
220
228
|
value !== null &&
|
|
221
229
|
!(typeof value === "string" && value.trim() === "") &&
|
|
222
230
|
!(typeof value === "number" && value.toString().trim() === "")) {
|
|
@@ -238,19 +246,6 @@ class DataBuilder {
|
|
|
238
246
|
}
|
|
239
247
|
}
|
|
240
248
|
lodash_1.default.set(element, fieldPath, elementVal);
|
|
241
|
-
// lodash.set(
|
|
242
|
-
// element,
|
|
243
|
-
// fieldPath,
|
|
244
|
-
// value === undefined || value === null || (typeof value === "string" && value.trim() === "")
|
|
245
|
-
// ? null
|
|
246
|
-
// : customType && typeof customType.onSave === "function"
|
|
247
|
-
// ? await customType.onSave(value, { ...payload, ...fields[key].payload })
|
|
248
|
-
// : fields[key].type === "currency" || fields[key].type === "float"
|
|
249
|
-
// ? parseFloat(value.toString().replace(",", "."))
|
|
250
|
-
// : fields[key].type === "integer"
|
|
251
|
-
// ? parseInt(value)
|
|
252
|
-
// : value
|
|
253
|
-
// );
|
|
254
249
|
}
|
|
255
250
|
}
|
|
256
251
|
return element;
|
package/package.json
CHANGED
|
@@ -281,7 +281,13 @@ export class DataBuilder {
|
|
|
281
281
|
}
|
|
282
282
|
} else {
|
|
283
283
|
let elementVal = null;
|
|
284
|
-
if (
|
|
284
|
+
if (fields[key].type === "ObjectId") {
|
|
285
|
+
if (value && (value.toString().length === 12 || value.toString().length === 24)) {
|
|
286
|
+
elementVal = typeof value === "string" ? await Model.objectId(value) : value;
|
|
287
|
+
} else {
|
|
288
|
+
elementVal = await Model.objectId();
|
|
289
|
+
}
|
|
290
|
+
} else if (
|
|
285
291
|
value !== undefined &&
|
|
286
292
|
value !== null &&
|
|
287
293
|
!(typeof value === "string" && value.trim() === "") &&
|
|
@@ -309,19 +315,6 @@ export class DataBuilder {
|
|
|
309
315
|
}
|
|
310
316
|
|
|
311
317
|
lodash.set(element, fieldPath, elementVal);
|
|
312
|
-
// lodash.set(
|
|
313
|
-
// element,
|
|
314
|
-
// fieldPath,
|
|
315
|
-
// value === undefined || value === null || (typeof value === "string" && value.trim() === "")
|
|
316
|
-
// ? null
|
|
317
|
-
// : customType && typeof customType.onSave === "function"
|
|
318
|
-
// ? await customType.onSave(value, { ...payload, ...fields[key].payload })
|
|
319
|
-
// : fields[key].type === "currency" || fields[key].type === "float"
|
|
320
|
-
// ? parseFloat(value.toString().replace(",", "."))
|
|
321
|
-
// : fields[key].type === "integer"
|
|
322
|
-
// ? parseInt(value)
|
|
323
|
-
// : value
|
|
324
|
-
// );
|
|
325
318
|
}
|
|
326
319
|
}
|
|
327
320
|
|