Open neerajincaendo opened 7 years ago
Validators run synchronously, whereas service methods run asynchronously. You'll need to implement this additional validation logic as a hook.
If you're willing to submit a PR to allow async validators, that would be nice, but I don't really plan on touching this library every again. I haven't used Feathers in a long time.
Hello, i am making unique validator function. But encountered a problem , the response of query is coming after return can you help me with this.
function generateUniqueValidatorFunction(params, data){ "use strict"; return function (key, value){ var query = {}; var res; query[params[1]] = data[params[1]]; hook.app.service(hook.path).find({query: query }).then(function(found){ console.log('found '+ JSON.stringify(found)); if(found.data.length > 0){ return { valid: true }; }else{ return { valid: false, error: 'The '+ key + ' must be unique.' }; }
}
Please Help!!!!!