restablecido filtre

This commit is contained in:
nelo 2017-05-18 13:40:42 +02:00
parent 51c145158b
commit 7691449e52
1 changed files with 9 additions and 7 deletions

View File

@ -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) {