From e6309bb6cab84328ccadcedbdd66394bc5366073 Mon Sep 17 00:00:00 2001 From: Stepan Usatiuk Date: Sat, 12 Jan 2019 23:56:43 +0300 Subject: [PATCH] reverse todos in lists --- routes/lists.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/lists.js b/routes/lists.js index f11c527..987b054 100644 --- a/routes/lists.js +++ b/routes/lists.js @@ -15,7 +15,7 @@ router.get( const lists = await TodoList.find({ user: req.user.id }) .populate('todos') .exec(); - res.json({ success: true, data: lists.map(list => list.toJson()) }); + res.json({ success: true, data: lists.map(list => { list.todos.reverse(); list.toJson() }) }); }), );