restablecido filtre
This commit is contained in:
parent
51c145158b
commit
7691449e52
|
@ -26,13 +26,6 @@ module.exports = function(self) {
|
|||
//this.disableRemoteMethod(method, disableMethods[method]);
|
||||
}
|
||||
|
||||
self.on('find', function() {
|
||||
self.printModelName();
|
||||
});
|
||||
|
||||
self.list = function(filter, cb){
|
||||
self.find(filter, cb);
|
||||
}
|
||||
}
|
||||
|
||||
self.installMethod = function(methodName, filterCb) {
|
||||
|
@ -61,6 +54,15 @@ module.exports = function(self) {
|
|||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.filter = (params, cb) => {
|
||||
let filter = removeEmpty(filterCb(params));
|
||||
this.find(filter, function(err, instances) {
|
||||
if(!err)
|
||||
cb(null, instances);
|
||||
})
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
function removeEmpty(o) {
|
||||
|
|
Loading…
Reference in New Issue