Improved Search

This commit is contained in:
dbroqua 2019-04-12 13:20:17 +02:00
parent c121746380
commit 53cebca836

View File

@ -160,11 +160,16 @@ class Vegetables {
} }
vegetables.findAndCountAll({ vegetables.findAndCountAll({
where: { where: {
name: { [Op.or]: {
[Op.like]: `%${req.query.q}%` name: {
[Op.like]: `%${req.query.q}%`
},
'$Properties.value$': {
[Op.like]: `%${req.query.q}%`
}
} }
}, },
include: ['Type'], include: ['Type', 'Properties'],
order: [ order: [
['name', 'ASC'] ['name', 'ASC']
] ]