fix tags/places filters

This commit is contained in:
lesion 2022-01-25 01:30:47 +01:00
parent 4e28423688
commit ef65d3f9dd
No known key found for this signature in database
GPG key ID: 352918250B012177
2 changed files with 26 additions and 8 deletions

View file

@ -504,13 +504,21 @@ 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(',') : []
'$tags.tag$': tags.split(',')
}
}
if (tags) {
where['$tags.tag$'] = tags.split(',')
}
if (places) {
where.placeId = places.split(',')
}
const events = await Event.findAll({
where,
attributes: {

View file

@ -17,12 +17,22 @@ const exportController = {
const where = {}
const yesterday = moment().subtract('1', 'day').unix()
if (places || tags) {
if (tags && places) {
where[Op.or] = {
placeId: places ? places.split(',') : [],
'$tags.tag$': tags ? tags.split(',') : []
'$tags.tag$': tags.split(',')
}
}
if (tags) {
where['$tags.tag$'] = tags.split(',')
}
if (places) {
where.placeId = places.split(',')
}
if (!show_recurrent) {
where.parentId = null
}