Merge branch 'master' into fix-update-providers-issue

This commit is contained in:
Jim LAURIE 2018-07-16 17:50:04 +02:00 committed by GitHub
commit 896077c6f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,8 +3,16 @@ const _ = require('lodash');
module.exports = {
find: async function (params = {}, populate) {
const records = await this.query(function(qb) {
_.forEach(params.where, (where, key) => {
qb.where(key, where[0].symbol, where[0].value);
Object.keys(params.where).forEach((key) => {
const where = params.where[key];
if (Array.isArray(where.value)) {
for (const value in where.value) {
qb[value ? 'where' : 'orWhere'](key, where.symbol, where.value[value]);
}
} else {
qb.where(key, where.symbol, where.value);
}
});
if (params.sort) {