From 908233e842bec3a256d76e59e7780de5192725e0 Mon Sep 17 00:00:00 2001 From: arnaucode Date: Sat, 25 Feb 2017 12:59:02 +0100 Subject: [PATCH] fixed getEventsByFollowingArray --- controllers/eventController.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/controllers/eventController.js b/controllers/eventController.js index 34bb021..e32ef32 100644 --- a/controllers/eventController.js +++ b/controllers/eventController.js @@ -175,9 +175,14 @@ això retorna els events d'aquests users que segueixes */ exports.getEventsByFollowingArray = function(req, res) { + if(req.body.users==null) + { + res.status(200).jsonp(null); + } eventModel.find({ date: {$gte: new Date()}, - 'username': req.body.users + 'user': req.body.users, + type: {$nin: ["alert"]}//cal filtrar per type d'event, aquí només agafem els type: alert }) .lean() .populate('user', 'username img shortDescription')