mirror of
https://github.com/strapi/strapi.git
synced 2025-10-15 18:16:24 +00:00
Fix invalid filter name and cleanup some search query
This commit is contained in:
parent
f5365179d5
commit
cfe28bcfa6
@ -112,8 +112,8 @@ module.exports = ({ model }) => {
|
|||||||
qb.orderBy(filters.sort.key, filters.sort.order);
|
qb.orderBy(filters.sort.key, filters.sort.order);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.skip) {
|
if (filters.start) {
|
||||||
qb.offset(_.toNumber(filters.skip));
|
qb.offset(_.toNumber(filters.start));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters.limit) {
|
if (filters.limit) {
|
||||||
@ -173,13 +173,13 @@ const buildSearchQuery = (qb, model, params) => {
|
|||||||
|
|
||||||
if (!_.isNaN(_.toNumber(query))) {
|
if (!_.isNaN(_.toNumber(query))) {
|
||||||
searchInt.forEach(attribute => {
|
searchInt.forEach(attribute => {
|
||||||
qb.orWhereRaw(`${attribute} = ${_.toNumber(query)}`);
|
qb.orWhereRaw(attribute, _.toNumber(query));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query === 'true' || query === 'false') {
|
if (query === 'true' || query === 'false') {
|
||||||
searchBool.forEach(attribute => {
|
searchBool.forEach(attribute => {
|
||||||
qb.orWhereRaw(`${attribute} = ${_.toNumber(query === 'true')}`);
|
qb.orWhereRaw(attribute, _.toNumber(query === 'true'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user