From 16b3a44f8adb2b6d1e8d6522b52a31aaddec818d Mon Sep 17 00:00:00 2001 From: Alexandre Bodin Date: Mon, 9 Aug 2021 18:20:27 +0200 Subject: [PATCH] Check nil values in query builder --- .../core/database/lib/query/query-builder.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/core/database/lib/query/query-builder.js b/packages/core/database/lib/query/query-builder.js index 1fe6bcfb3b..043bc26a22 100644 --- a/packages/core/database/lib/query/query-builder.js +++ b/packages/core/database/lib/query/query-builder.js @@ -110,37 +110,37 @@ const createQueryBuilder = (uid, db) => { init(params = {}) { const { _q, where, select, limit, offset, orderBy, groupBy, populate } = params; - if (where) { + if (!_.isNil(where)) { this.where(where); } - if (_q) { + if (!_.isNil(_q)) { this.search(_q); } - if (select) { + if (!_.isNil(select)) { this.select(select); } else { this.select('*'); } - if (limit) { + if (!_.isNil(limit)) { this.limit(limit); } - if (offset) { + if (!_.isNil(offset)) { this.offset(offset); } - if (orderBy) { + if (!_.isNil(orderBy)) { this.orderBy(orderBy); } - if (groupBy) { + if (!_.isNil(groupBy)) { this.groupBy(groupBy); } - if (populate) { + if (!_.isNil(populate)) { this.populate(populate); }