mirror of
https://github.com/strapi/strapi.git
synced 2025-08-19 22:27:18 +00:00
Merge pull request #2965 from Prat041192/patch-1
Update beforeFetchAll life cycle Bookshelf
This commit is contained in:
commit
f51596c475
@ -20,6 +20,14 @@ module.exports = {
|
||||
// After fetching a value.
|
||||
// Fired after a `fetch` operation.
|
||||
// afterFetch: async (model, response, options) => {},
|
||||
|
||||
// Before fetching all values.
|
||||
// Fired before a `fetchAll` operation.
|
||||
// beforeFetchAll: async (model, columns, options) => {},
|
||||
|
||||
// After fetching all values.
|
||||
// Fired after a `fetchAll` operation.
|
||||
// afterFetchAll: async (model, response, options) => {},
|
||||
|
||||
// Before creating a value.
|
||||
// Fired before an `insert` query.
|
||||
|
@ -236,9 +236,9 @@ module.exports = function(strapi) {
|
||||
updating: 'beforeUpdate',
|
||||
updated: 'afterUpdate',
|
||||
fetching: 'beforeFetch',
|
||||
'fetching:collection': 'beforeFetchCollection',
|
||||
'fetching:collection': 'beforeFetchAll',
|
||||
fetched: 'afterFetch',
|
||||
'fetched:collection': 'afterFetchCollection',
|
||||
'fetched:collection': 'afterFetchAll',
|
||||
saving: 'beforeSave',
|
||||
saved: 'afterSave'
|
||||
};
|
||||
@ -287,9 +287,9 @@ module.exports = function(strapi) {
|
||||
}
|
||||
|
||||
return _.isFunction(
|
||||
target[model.toLowerCase()]['beforeFetchCollection']
|
||||
target[model.toLowerCase()]['beforeFetchAll']
|
||||
)
|
||||
? target[model.toLowerCase()]['beforeFetchCollection']
|
||||
? target[model.toLowerCase()]['beforeFetchAll']
|
||||
: Promise.resolve();
|
||||
});
|
||||
|
||||
@ -314,7 +314,7 @@ module.exports = function(strapi) {
|
||||
target: 'afterFetch'
|
||||
}, {
|
||||
name: 'fetched:collection',
|
||||
target: 'afterFetchCollection'
|
||||
target: 'afterFetchAll'
|
||||
}];
|
||||
|
||||
const jsonFormatter = (attributes) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user