mirror of
https://github.com/arnaucube/openEventsPlatformServer.git
synced 2026-02-06 19:26:39 +01:00
events by day implemented, todo: calendar view to select a day
This commit is contained in:
@@ -210,3 +210,21 @@ exports.getEventsByCategory = function(req, res) {
|
|||||||
res.status(200).jsonp(events);
|
res.status(200).jsonp(events);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.getEventsByDay = function(req, res) {
|
||||||
|
var dayRequested= new Date(req.params.day);
|
||||||
|
eventModel.find({
|
||||||
|
date: {
|
||||||
|
$gte: dayRequested
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.lean()
|
||||||
|
.populate('user', 'username img shortDescription')
|
||||||
|
.sort('date')
|
||||||
|
.limit(pageSize)
|
||||||
|
.skip(pageSize * Number(req.query.page))
|
||||||
|
.exec(function (err, events) {
|
||||||
|
if (err) return res.send(500, err.message);
|
||||||
|
res.status(200).jsonp(events);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ apiRoutes.route('/events/following')
|
|||||||
.post(eventCtrl.getEventsByFollowingArray);
|
.post(eventCtrl.getEventsByFollowingArray);
|
||||||
apiRoutes.route('/events/category/:category')
|
apiRoutes.route('/events/category/:category')
|
||||||
.get(eventCtrl.getEventsByCategory);
|
.get(eventCtrl.getEventsByCategory);
|
||||||
|
apiRoutes.route('/events/day/:day')
|
||||||
|
.get(eventCtrl.getEventsByDay);
|
||||||
|
|
||||||
apiRoutes.route('/categoriesList')
|
apiRoutes.route('/categoriesList')
|
||||||
.get(eventCtrl.getCategoriesList);
|
.get(eventCtrl.getCategoriesList);
|
||||||
|
|||||||
Reference in New Issue
Block a user