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: {
[Op.or]: {
name: { name: {
[Op.like]: `%${req.query.q}%` [Op.like]: `%${req.query.q}%`
},
'$Properties.value$': {
[Op.like]: `%${req.query.q}%`
}
} }
}, },
include: ['Type'], include: ['Type', 'Properties'],
order: [ order: [
['name', 'ASC'] ['name', 'ASC']
] ]