millas 0.2.14 → 0.2.15
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/package.json +1 -1
- package/src/orm/model/Model.js +6 -1
package/package.json
CHANGED
package/src/orm/model/Model.js
CHANGED
|
@@ -761,7 +761,12 @@ class Model {
|
|
|
761
761
|
}
|
|
762
762
|
|
|
763
763
|
static _hydrate(row) {
|
|
764
|
-
|
|
764
|
+
const fields = this.getFields();
|
|
765
|
+
const cast = {};
|
|
766
|
+
for (const [key, val] of Object.entries(row)) {
|
|
767
|
+
cast[key] = (fields[key]?.type === 'boolean' && val != null) ? Boolean(val) : val;
|
|
768
|
+
}
|
|
769
|
+
return new this(cast);
|
|
765
770
|
}
|
|
766
771
|
|
|
767
772
|
static async _hydrateFromTrx(id, trx) {
|