@webtypen/webframez-core 0.3.5 → 0.3.8
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.
|
@@ -40,7 +40,7 @@ class DataBuilder {
|
|
|
40
40
|
key: key,
|
|
41
41
|
singular: model.__singular,
|
|
42
42
|
plural: model.__plural,
|
|
43
|
-
schema: Object.assign(Object.assign({}, model.__schema), { collection: key }),
|
|
43
|
+
schema: Object.assign(Object.assign({}, model.__schema), { collection: model.__schema.collection ? model.__schema.collection : model.__table ? model.__table : key }),
|
|
44
44
|
forms: model.__forms,
|
|
45
45
|
});
|
|
46
46
|
}
|
|
@@ -303,6 +303,24 @@ class DataBuilder {
|
|
|
303
303
|
else if (fields[key].type === "integer") {
|
|
304
304
|
elementVal = parseInt(value);
|
|
305
305
|
}
|
|
306
|
+
// Integer datetime
|
|
307
|
+
else if (fields[key].type === "datetime") {
|
|
308
|
+
if (typeof value === "string") {
|
|
309
|
+
const [datePart, timePart] = value.trim().split(" ");
|
|
310
|
+
if (!datePart || datePart.trim() === "") {
|
|
311
|
+
elementVal = value;
|
|
312
|
+
}
|
|
313
|
+
else if (!datePart.includes("-") && datePart.match(/^\d{1,2}:\d{2}$/)) {
|
|
314
|
+
elementVal = null;
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
elementVal = datePart.trim() + " " + (timePart && timePart.includes(":") ? timePart.trim() : "00:00");
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
elementVal = null;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
306
324
|
// Standard
|
|
307
325
|
else {
|
|
308
326
|
elementVal = value;
|
package/package.json
CHANGED
|
@@ -69,7 +69,10 @@ export class DataBuilder {
|
|
|
69
69
|
key: key,
|
|
70
70
|
singular: model.__singular,
|
|
71
71
|
plural: model.__plural,
|
|
72
|
-
schema: {
|
|
72
|
+
schema: {
|
|
73
|
+
...model.__schema,
|
|
74
|
+
collection: model.__schema.collection ? model.__schema.collection : model.__table ? model.__table : key,
|
|
75
|
+
},
|
|
73
76
|
forms: model.__forms,
|
|
74
77
|
});
|
|
75
78
|
}
|
|
@@ -380,6 +383,22 @@ export class DataBuilder {
|
|
|
380
383
|
elementVal = parseInt(value);
|
|
381
384
|
}
|
|
382
385
|
|
|
386
|
+
// Integer datetime
|
|
387
|
+
else if (fields[key].type === "datetime") {
|
|
388
|
+
if (typeof value === "string") {
|
|
389
|
+
const [datePart, timePart] = value.trim().split(" ");
|
|
390
|
+
if (!datePart || datePart.trim() === "") {
|
|
391
|
+
elementVal = value;
|
|
392
|
+
} else if (!datePart.includes("-") && datePart.match(/^\d{1,2}:\d{2}$/)) {
|
|
393
|
+
elementVal = null;
|
|
394
|
+
} else {
|
|
395
|
+
elementVal = datePart.trim() + " " + (timePart && timePart.includes(":") ? timePart.trim() : "00:00");
|
|
396
|
+
}
|
|
397
|
+
} else {
|
|
398
|
+
elementVal = null;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
383
402
|
// Standard
|
|
384
403
|
else {
|
|
385
404
|
elementVal = value;
|