mirror of
https://github.com/strapi/strapi.git
synced 2025-12-28 07:33:17 +00:00
fix(upload): improve query find for bookshelf
This commit is contained in:
parent
cd41c663e6
commit
8a5e4c48ad
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user