adonis-lucid-mongodb
Advanced tools
Comparing version 0.10.8 to 0.11.0
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "0.10.8", | ||
"version": "0.11.0", | ||
"scripts": { | ||
@@ -11,0 +11,0 @@ "lint": "standard", |
@@ -508,2 +508,24 @@ 'use strict' | ||
/** | ||
* date fields auto convert to moment | ||
* | ||
* @return {Array} | ||
* | ||
* @public | ||
*/ | ||
static get dateFields () { | ||
return [] | ||
} | ||
/** | ||
* date fields auto convert to GeoPoint | ||
* | ||
* @return {Array} | ||
* | ||
* @public | ||
*/ | ||
static get geoFields () { | ||
return [] | ||
} | ||
/** | ||
* created at field getter method, by default | ||
@@ -907,3 +929,3 @@ * it returns an instance of moment js. | ||
set (key, value) { | ||
this.attributes[key] = value | ||
this.attributes[key] = this.mutateProperty(key, value) | ||
return this | ||
@@ -1188,3 +1210,3 @@ } | ||
get (key) { | ||
return this.attributes[key] | ||
return this.accessProperty(key, this.attributes[key]) | ||
} | ||
@@ -1289,5 +1311,5 @@ | ||
class ExtendedModel extends mixin(Model, Mixins.AccessorMutator, Mixins.Serializer, Mixins.Persistance, Mixins.Dates, Mixins.Hooks) { | ||
class ExtendedModel extends mixin(Model, Mixins.AccessorMutator, Mixins.Serializer, Mixins.Persistance, Mixins.Dates, Mixins.Hooks, Mixins.FieldTypes) { | ||
} | ||
module.exports = ExtendedModel |
@@ -73,2 +73,4 @@ 'use strict' | ||
AccessortMutator.mutateProperty = function (property, value) { | ||
// transform field with type | ||
value = this.getValueWithType(property, value) | ||
const setter = util.makeSetterName(property) | ||
@@ -75,0 +77,0 @@ if (typeof (this[setter]) === 'function') { |
@@ -17,3 +17,4 @@ 'use strict' | ||
Persistance: require('./Persistance'), | ||
FieldTypes: require('./FieldTypes'), | ||
Serializer: require('./Serializer') | ||
} |
@@ -32,3 +32,3 @@ 'use strict' | ||
const insertHandler = function * () { | ||
const values = this.attributes | ||
const values = this.getStoreValues(this.attributes) | ||
if (!values || _.size(values) < 1) { | ||
@@ -75,3 +75,3 @@ throw CE.ModelException.invalidState(`Cannot save empty ${this.constructor.name} model`) | ||
yield query.connect() | ||
const dirtyValues = this.$dirty | ||
const dirtyValues = this.getStoreValues(this.$dirty) | ||
if (!_.size(dirtyValues) && !this.unsetFields.length) { | ||
@@ -78,0 +78,0 @@ return 0 |
@@ -29,3 +29,3 @@ 'use strict' | ||
.transform((result, value, key) => { | ||
result[key] = this[key] | ||
result[key] = this.getFormatedField(key, this[key]) | ||
}) | ||
@@ -32,0 +32,0 @@ .merge(this.initializeComputedProperties()) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
215359
61
7893