fix tags/places filters

This commit is contained in:
lesion
2022-01-25 01:30:47 +01:00
parent 4e28423688
commit ef65d3f9dd
2 changed files with 26 additions and 8 deletions

View File

@@ -504,12 +504,20 @@ const eventController = {
where.start_datetime = { [Op.lte]: end }
}
if (places || tags) {
if (tags && places) {
where[Op.or] = {
placeId: places ? places.split(',') : [],
'$tags.tag$': tags ? tags.split(',') : []
}
placeId: places ? places.split(',') : [],
'$tags.tag$': tags.split(',')
}
}
if (tags) {
where['$tags.tag$'] = tags.split(',')
}
if (places) {
where.placeId = places.split(',')
}
const events = await Event.findAll({
where,