Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function count(params) {
const filters = convertRestQueryParams(params);
return buildQuery({
model,
filters: { where: filters.where },
}).count();
}
function find(params, populate) {
const populateOpt = populate || defaultPopulate;
const filters = convertRestQueryParams(params);
return buildQuery({
model,
filters,
populate: populateOpt,
});
}
count: async function(params = {}) {
const model = this;
const { where } = convertRestQueryParams(params);
return this.query(buildQuery({ model, filters: { where } })).count();
},
find: async function(params, populate) {
const model = this;
const filters = convertRestQueryParams(params);
return buildQuery({
model,
filters,
populate: populate || model.associations.map(x => x.alias),
}).lean();
},
function find(params, populate) {
const populateOpt = populate || defaultPopulate;
const filters = convertRestQueryParams(params);
return buildQuery({
model,
filters,
populate: populateOpt,
}).then(results =>
results.map(result => (result ? result.toObject() : null))
);
}
count: async function(params) {
const model = this;
const filters = convertRestQueryParams(params);
return buildQuery({
model,
filters: { where: filters.where },
}).count();
},
function count(params) {
const filters = convertRestQueryParams(params);
return buildQuery({
model,
filters: { where: filters.where },
}).count();
}
count(params = {}) {
const { where } = convertRestQueryParams(params);
return model.query(buildQuery({ model, filters: { where } })).count();
},
function count(params = {}) {
const { where } = convertRestQueryParams(params);
return model.query(buildQuery({ model, filters: { where } })).count();
}