rittenhop-dev/versions/5.94.2/node_modules/@tryghost/bookshelf-custom-query/lib/bookshelf-custom-query.js

20 lines
472 B
JavaScript
Raw Normal View History

2024-09-23 19:40:12 -04:00
/**
* @param {import('bookshelf')} Bookshelf
*/
const customQueryPlug = function customQueryPlug(Bookshelf) {
const Model = Bookshelf.Model.extend({
// override this on the model itself
customQuery() {},
applyCustomQuery: function applyCustomQuery(options) {
this.query((qb) => {
this.customQuery(qb, options);
});
}
});
Bookshelf.Model = Model;
};
module.exports = customQueryPlug;