chore(xo-server/Model): remove unused validate()
This commit is contained in:
parent
e86b30f205
commit
8e7e1fccbe
@ -38,19 +38,7 @@ export default class Collection extends EventEmitter {
|
||||
const { Model } = this
|
||||
map(
|
||||
models,
|
||||
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
|
||||
},
|
||||
model => (model instanceof Model ? model.properties : model),
|
||||
models
|
||||
)
|
||||
|
||||
@ -112,12 +100,6 @@ export default class Collection extends EventEmitter {
|
||||
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
|
||||
},
|
||||
models
|
||||
|
@ -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 (name, def) {
|
||||
const value = this.properties[name]
|
||||
|
Loading…
Reference in New Issue
Block a user