Moved defaultColumnsToFetch to Bookshelf CRUD plugin

no issue

- the CRUD plugin uses this function so we want to keep similar things
  together to make it easier to test in the future
This commit is contained in:
Daniel Lockyer 2021-06-17 16:59:14 +01:00
parent 0830bcb74e
commit a457631a20
No known key found for this signature in database
GPG Key ID: D21186F0B47295AD
2 changed files with 5 additions and 5 deletions

View File

@ -33,11 +33,6 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
.filter(key => key.indexOf('@@') === -1);
},
// When loading an instance, subclasses can specify default to fetch
defaultColumnsToFetch: function defaultColumnsToFetch() {
return [];
},
// Bookshelf `initialize` - declare a constructor-like method for model creation
initialize: function initialize() {
this.initializeEvents();

View File

@ -210,6 +210,11 @@ module.exports = function (Bookshelf) {
// Fetch the object before destroying it, so that the changed data is available to events
const obj = await this.forge(options.destroyBy).fetch(options);
return obj.destroy(options);
},
// When loading an instance, subclasses can specify default to fetch
defaultColumnsToFetch: function defaultColumnsToFetch() {
return [];
}
});
};