0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Moved allowed filter option to base model

no issue

- no need to define the filter option in each model
This commit is contained in:
kirrg001 2019-01-29 22:57:11 +01:00
parent 1aaf069fc8
commit 87bb3052a8
5 changed files with 6 additions and 4 deletions

View file

@ -514,6 +514,8 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
return baseOptions.concat(extraOptions, ['require']);
case 'findAll':
return baseOptions.concat(extraOptions, ['columns']);
case 'findPage':
return baseOptions.concat(extraOptions, ['filter']);
default:
return baseOptions.concat(extraOptions);
}

View file

@ -658,7 +658,7 @@ Post = ghostBookshelf.Model.extend({
// these are the only options that can be passed to Bookshelf / Knex.
validOptions = {
findOne: ['columns', 'importing', 'withRelated', 'require'],
findPage: ['page', 'limit', 'columns', 'filter', 'order', 'status', 'staticPages'],
findPage: ['page', 'limit', 'columns', 'order', 'status', 'staticPages'],
findAll: ['columns', 'filter'],
destroy: ['destroyAll']
};

View file

@ -42,7 +42,7 @@ Subscriber = ghostBookshelf.Model.extend({
// whitelists for the `options` hash argument on methods, by method name.
// these are the only options that can be passed to Bookshelf / Knex.
validOptions = {
findPage: ['page', 'limit', 'columns', 'filter', 'order'],
findPage: ['page', 'limit', 'columns', 'order'],
findAll: ['columns']
};

View file

@ -74,7 +74,7 @@ Tag = ghostBookshelf.Model.extend({
// whitelists for the `options` hash argument on methods, by method name.
// these are the only options that can be passed to Bookshelf / Knex.
validOptions = {
findPage: ['page', 'limit', 'columns', 'filter', 'order'],
findPage: ['page', 'limit', 'columns', 'order'],
findAll: ['columns'],
findOne: ['visibility'],
destroy: ['destroyAll']

View file

@ -338,7 +338,7 @@ User = ghostBookshelf.Model.extend({
setup: ['id'],
edit: ['withRelated', 'importPersistUser'],
add: ['importPersistUser'],
findPage: ['page', 'limit', 'columns', 'filter', 'order', 'status'],
findPage: ['page', 'limit', 'columns', 'order', 'status'],
findAll: ['filter']
};