mirror of
https://github.com/strapi/strapi.git
synced 2025-12-28 23:57:32 +00:00
Remove params reference
This commit is contained in:
parent
f4a25e5c78
commit
c50b400f8e
@ -21,18 +21,18 @@ module.exports = {
|
||||
*/
|
||||
|
||||
fetchAll: (params) => {
|
||||
params = strapi.utils.models.convertParams('<%= globalID.toLowerCase() %>', params);
|
||||
const convertedParams = strapi.utils.models.convertParams('<%= globalID.toLowerCase() %>', params);
|
||||
|
||||
return <%= globalID %>.query(function(qb) {
|
||||
_.forEach(params.where, (where, key) => {
|
||||
_.forEach(convertedParams.where, (where, key) => {
|
||||
qb.where(key, where.symbol, where.value);
|
||||
});
|
||||
|
||||
qb.orderBy(params.sort);
|
||||
qb.orderBy(convertedParams.sort);
|
||||
|
||||
qb.offset(params.start);
|
||||
qb.offset(convertedParams.start);
|
||||
|
||||
qb.limit(params.limit);
|
||||
qb.limit(convertedParams.limit);
|
||||
}).fetchAll({
|
||||
withRelated: _.keys(_.groupBy(_.reject(strapi.models.<%= id %>.associations, {autoPopulate: false}), 'alias'))
|
||||
});
|
||||
|
||||
@ -18,14 +18,14 @@ module.exports = {
|
||||
*/
|
||||
|
||||
fetchAll: (params) => {
|
||||
params = strapi.utils.models.convertParams('<%= globalID.toLowerCase() %>', params);
|
||||
const convertedParams = strapi.utils.models.convertParams('<%= globalID.toLowerCase() %>', params);
|
||||
|
||||
return <%= globalID %>
|
||||
.find()
|
||||
.where(params.where)
|
||||
.sort(params.sort)
|
||||
.skip(params.start)
|
||||
.limit(params.limit)
|
||||
.where(convertedParams.where)
|
||||
.sort(convertedParams.sort)
|
||||
.skip(convertedParams.start)
|
||||
.limit(convertedParams.limit)
|
||||
.populate(_.keys(_.pickBy(strapi.models.<%= humanizeId %>.attributes, { autoPopulate: true })).join(' '));
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user