mirror of
https://github.com/strapi/strapi.git
synced 2025-11-12 16:22:10 +00:00
GraphQL filters
This commit is contained in:
parent
48514fa8c4
commit
5366b1c6ad
@ -8,8 +8,7 @@ const _ = require('lodash');
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
fetchAll: async (params, query) => {
|
fetchAll: async (params, query) => {
|
||||||
const { query : request, queryAttribute, source, page, populate = [] } = query; // eslint-disable-line no-unused-vars
|
const { limit, skip, sort, query : request, queryAttribute, source, page, populate = [] } = query; // eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
// Remove the source key since it is not a filter
|
// Remove the source key since it is not a filter
|
||||||
delete query.source;
|
delete query.source;
|
||||||
const filters = strapi.utils.models.convertParams(params.model, query);
|
const filters = strapi.utils.models.convertParams(params.model, query);
|
||||||
@ -18,12 +17,10 @@ module.exports = {
|
|||||||
|
|
||||||
// Find entries using `queries` system
|
// Find entries using `queries` system
|
||||||
return await strapi.query(params.model, source).find({
|
return await strapi.query(params.model, source).find({
|
||||||
limit: filters.limit,
|
limit: limit || filters.limit,
|
||||||
skip: filters.start || 0,
|
skip: skip || filters.start || 0,
|
||||||
sort: filters.sort,
|
sort: sort || filters.sort,
|
||||||
// TODO make this work with graphql
|
|
||||||
where,
|
where,
|
||||||
// where: request,
|
|
||||||
queryAttribute,
|
queryAttribute,
|
||||||
}, populate);
|
}, populate);
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user