Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
};
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.'