diff --git a/controllers/worshipController.js b/controllers/worshipController.js index 487546e..ae3eb01 100644 --- a/controllers/worshipController.js +++ b/controllers/worshipController.js @@ -93,7 +93,7 @@ exports.deleteWorship = async (req, res) => { }; exports.getFilteredWorships = async (req, res) => { - const { location, order } = req.query; + const { location, order, neighborInvitation } = req.query; const where = {}; if (order && order.trim() === '') { order = 'date DESC'; @@ -104,6 +104,10 @@ exports.getFilteredWorships = async (req, res) => { [Sequelize.Op.in]: locations } } + const wantsNeighborhood = String(neighborInvitation || '').toLowerCase() === 'true'; + if (wantsNeighborhood) { + where.neighborInvitation = true; + } where.date = { [Op.gte]: fn('CURDATE'), };