How to use the graphql-sequelize.argsToFindOptions.default function in graphql-sequelize

To help you get started, we’ve selected a few graphql-sequelize 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 almost-full-stack / sequelize-graphql-schema / src / resolvers / query.js View on Github external
const before = (findOptions, args) => {

      if (isAssociation && model.through) {
        findOptions.through = {
          attributes: Object.keys(model.through.model.rawAttributes)
        };
      }

      if (args.throughWhere) {
        findOptions.where = argsToFindOptions.default({ where: args.throughWhere }, Object.keys(model.through.model.rawAttributes));
      }

      const order = getOrderBy(args.order);

      findOptions.order = order.length ? order : undefined;

      // if paranoid option from sequelize is set, this switch can be used to fetch archived, non-archived or all items.
      findOptions.paranoid = ((args.where && args.where.deletedAt && args.where.deletedAt.ne === null) || args.paranoid === false) ? false : model.options.paranoid;

      return findOptions;
    };
github almost-full-stack / sequelize-graphql-schema / src / libs / generateQueries.js View on Github external
resolve: (source, { where }, context, info) => {
            const args = argsToFindOptions.default({ where });

            if (args.where) whereQueryVarsToValues(args.where, info.variableValues);

            return models[modelTypeName].count({
              where: args.where
            });
          },
          description: 'A count of the total number of objects in this connection, ignoring pagination.'