mirror of
https://github.com/strapi/strapi.git
synced 2025-08-20 14:49:38 +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.
|
// After fetching a value.
|
||||||
// Fired after a `fetch` operation.
|
// Fired after a `fetch` operation.
|
||||||
// afterFetch: async (model, response, options) => {},
|
// 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.
|
// Before creating a value.
|
||||||
// Fired before an `insert` query.
|
// Fired before an `insert` query.
|
||||||
|
@ -236,9 +236,9 @@ module.exports = function(strapi) {
|
|||||||
updating: 'beforeUpdate',
|
updating: 'beforeUpdate',
|
||||||
updated: 'afterUpdate',
|
updated: 'afterUpdate',
|
||||||
fetching: 'beforeFetch',
|
fetching: 'beforeFetch',
|
||||||
'fetching:collection': 'beforeFetchCollection',
|
'fetching:collection': 'beforeFetchAll',
|
||||||
fetched: 'afterFetch',
|
fetched: 'afterFetch',
|
||||||
'fetched:collection': 'afterFetchCollection',
|
'fetched:collection': 'afterFetchAll',
|
||||||
saving: 'beforeSave',
|
saving: 'beforeSave',
|
||||||
saved: 'afterSave'
|
saved: 'afterSave'
|
||||||
};
|
};
|
||||||
@ -287,9 +287,9 @@ module.exports = function(strapi) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return _.isFunction(
|
return _.isFunction(
|
||||||
target[model.toLowerCase()]['beforeFetchCollection']
|
target[model.toLowerCase()]['beforeFetchAll']
|
||||||
)
|
)
|
||||||
? target[model.toLowerCase()]['beforeFetchCollection']
|
? target[model.toLowerCase()]['beforeFetchAll']
|
||||||
: Promise.resolve();
|
: Promise.resolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ module.exports = function(strapi) {
|
|||||||
target: 'afterFetch'
|
target: 'afterFetch'
|
||||||
}, {
|
}, {
|
||||||
name: 'fetched:collection',
|
name: 'fetched:collection',
|
||||||
target: 'afterFetchCollection'
|
target: 'afterFetchAll'
|
||||||
}];
|
}];
|
||||||
|
|
||||||
const jsonFormatter = (attributes) => {
|
const jsonFormatter = (attributes) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user