From 6e30f739a613c1aaba25c44fc8cc35a5ec265253 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Tue, 14 Apr 2026 11:48:44 +0200 Subject: [PATCH] Enhance worship filtering functionality: Update getFilteredWorships method to include neighborInvitation query parameter, allowing for filtering based on neighborhood invitations. This improves the granularity of worship event retrieval based on user preferences. --- controllers/worshipController.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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'), };