Skip to content
Snippets Groups Projects
Commit 31e9077f authored by Moreau Elise's avatar Moreau Elise
Browse files

[room] fix duplicates and remove emit function

parent e62eede6
No related branches found
No related tags found
No related merge requests found
......@@ -44,7 +44,6 @@ router.post('/', validator.body(roomSchema), async function(req, res, next){
res.json(newRoom);
emit('new-room', newRoom, newRoom.users);
});
// Liste des room contenant l'utilisateur courant
......@@ -72,7 +71,6 @@ router.get('/:id/messages', async function (req, res, next) {
try {
room = await Room.findOne({ _id: req.params.id, users: req.user.id });
room = await Room.findById(req.params.id);
} catch (err){
return next(err);
}
......@@ -85,7 +83,6 @@ router.get('/:id/messages', async function (req, res, next) {
.populate('author')
.sort({ date: -1 })
.limit(50);
messages = await Message.find({room: room._id}).sort({ date: -1 }).limit(50);
} catch(err) {
return next(err);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment