mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 15:13:21 +00:00
Fix _q count. still does nott work with group by
This commit is contained in:
parent
c1f818958a
commit
23ab277472
@ -208,10 +208,10 @@ const preProcessGroupByData = function({ result, fieldKey, filters, model }) {
|
||||
return {
|
||||
...filters,
|
||||
where: {
|
||||
...filters.where || {},
|
||||
[fieldKey]: value._id
|
||||
}
|
||||
}
|
||||
...(filters.where || {}),
|
||||
[fieldKey]: value._id,
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
});
|
||||
@ -244,7 +244,6 @@ const createGroupByFieldsResolver = function(model, fields, name) {
|
||||
fieldResolver,
|
||||
fieldKey
|
||||
) => {
|
||||
|
||||
const params = {
|
||||
...GraphQLQuery.convertToParams(_.omit(filters, 'where')),
|
||||
...GraphQLQuery.convertToQuery(filters.where),
|
||||
@ -258,8 +257,6 @@ const createGroupByFieldsResolver = function(model, fields, name) {
|
||||
_id: `$${fieldKey}`,
|
||||
});
|
||||
|
||||
|
||||
|
||||
return preProcessGroupByData({
|
||||
result,
|
||||
fieldKey,
|
||||
@ -359,6 +356,9 @@ const formatConnectionAggregator = function(fields, model, modelName) {
|
||||
count(obj, options, context) {
|
||||
const opts = GraphQLQuery.convertToQuery(obj.where);
|
||||
|
||||
if (opts._q) { // allow search param
|
||||
return strapi.query(modelName).countSearch(opts);
|
||||
}
|
||||
return strapi.query(modelName).count(opts);
|
||||
},
|
||||
totalCount(obj, options, context) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user