Search code examples
sails.jsmodelswaterline

sails.js: Lifecycle callbacks for Models: Do they support beforeFind and afterFind?


In sails.js, Models support lifecycle callbacks for validate, create, update and destroy.

Is there support for callbacks for find() or query as well? Like beforeFind() and afterFind()?

The idea is same. I would want to validate / modify parameters before the query is run or after the query is run.

Any thoughts?


Solution

  • As of writing this it does NOT support these requests, however their is a pull request https://github.com/balderdashy/waterline/pull/525

    You can use policies to do this in the mean time.