node.js - Make waterline accept async custom validation -
how use async custom validation in waterline ?
i tried :
module.export = { types: { album : function(albumid) { album.findone(albumid) .then(function(album) { console.log(album !== undefined); // true return album != undefined; }) .catch(function(err) { return false; }); // if return true there, works }, } attributes: { album: { model: 'album', album: true } } }
but seems validation rejected because validation function returns before promise successed. tried returning promise doesn't work :p
Comments
Post a Comment