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:
@@ -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'),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user