mirror of
https://github.com/strapi/strapi.git
synced 2025-11-12 08:08:05 +00:00
Check nil values in query builder
This commit is contained in:
parent
d54610dc06
commit
16b3a44f8a
@ -110,37 +110,37 @@ const createQueryBuilder = (uid, db) => {
|
|||||||
init(params = {}) {
|
init(params = {}) {
|
||||||
const { _q, where, select, limit, offset, orderBy, groupBy, populate } = params;
|
const { _q, where, select, limit, offset, orderBy, groupBy, populate } = params;
|
||||||
|
|
||||||
if (where) {
|
if (!_.isNil(where)) {
|
||||||
this.where(where);
|
this.where(where);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_q) {
|
if (!_.isNil(_q)) {
|
||||||
this.search(_q);
|
this.search(_q);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (select) {
|
if (!_.isNil(select)) {
|
||||||
this.select(select);
|
this.select(select);
|
||||||
} else {
|
} else {
|
||||||
this.select('*');
|
this.select('*');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (limit) {
|
if (!_.isNil(limit)) {
|
||||||
this.limit(limit);
|
this.limit(limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset) {
|
if (!_.isNil(offset)) {
|
||||||
this.offset(offset);
|
this.offset(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (orderBy) {
|
if (!_.isNil(orderBy)) {
|
||||||
this.orderBy(orderBy);
|
this.orderBy(orderBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (groupBy) {
|
if (!_.isNil(groupBy)) {
|
||||||
this.groupBy(groupBy);
|
this.groupBy(groupBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (populate) {
|
if (!_.isNil(populate)) {
|
||||||
this.populate(populate);
|
this.populate(populate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user