I want to create and use some custom query methods for waterline.
For example method makeItAwesome
:
Article.makeItAwesome({
id: 42
}).exec(function(err, awesomeArticle) {
/* ... */
});
Of course I can add this makeItAwesome
to model's static methods but what if I want common stuff reusable for other models. Does sails.js or waterline by itself have built-in ways of doing it or I should do it by myself?
If not where is the best way to keep this stuff? Must it be a separate module to require in each model or I can somewhere extend each model prototype once?