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