How to use the strapi/lib/configuration/hooks/graphql/helpers/.handleFilters function in strapi

To help you get started, we’ve selected a few strapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strapi / strapi / packages / strapi-hook-bookshelf / lib / utils / graphql.js View on Github external
fetchLatest: (collectionIdentity, collection, criteria) => {
    const filters = _.omit(helpers.handleFilters(criteria), value => {
      return _.isUndefined(value) || _.isNumber(value) ? _.isNull(value) : _.isEmpty(value);
    });

    // Handle filters
    filters.orderBy = 'createdAt DESC';
    filters.limit = filters.count;

    delete filters.count;

    return collection.forge(criteria)
      .query(filters)
      .fetchAll({withRelated: helpers.getAssociationsByIdentity(collectionIdentity)})
      .then(data => data.toJSON() || data);
  },

strapi

An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MongoDB, MySQL, MariaDB, PostgreSQL, SQLite

SEE LICENSE IN LICENSE
Latest version published 1 year ago

Package Health Score

41 / 100
Full package analysis