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.

This commit is contained in:
Torsten Schulz (local)
2026-04-14 11:48:44 +02:00
parent fb4f5e42d0
commit 6e30f739a6

View File

@@ -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'),
};