chore(xo-server/Model): remove unused validate()

This commit is contained in:
Julien Fontanet 2018-08-14 14:18:42 +02:00
parent e86b30f205
commit 8e7e1fccbe
2 changed files with 1 additions and 24 deletions

View File

@ -38,19 +38,7 @@ export default class Collection extends EventEmitter {
const { Model } = this const { Model } = this
map( map(
models, models,
model => { model => (model instanceof Model ? model.properties : model),
if (!(model instanceof Model)) {
model = new Model(model)
}
const error = model.validate()
if (error) {
// TODO: Better system inspired by Backbone.js
throw error
}
return model.properties
},
models models
) )
@ -112,12 +100,6 @@ export default class Collection extends EventEmitter {
throw new Error('a model without an id cannot be updated') throw new Error('a model without an id cannot be updated')
} }
const error = model.validate()
if (error !== undefined) {
// TODO: Better system inspired by Backbone.js.
throw error
}
return model.properties return model.properties
}, },
models models

View File

@ -15,11 +15,6 @@ export default class Model extends EventEmitter {
} }
} }
// Validate the defined properties.
//
// Returns the error if any.
validate (properties) {}
// Get a property. // Get a property.
get (name, def) { get (name, def) {
const value = this.properties[name] const value = this.properties[name]