How can I define some validation rules depending on some conditions in request body.
For example, I want to validate that post description field is set only if the post is published (isPublished flag equals true), something like:
module.exports = function(Post) {
if(req.body.isPublished === true) {
Post.validatesPresenceOf('description');
}
}