reverse todos in lists

This commit is contained in:
2019-01-12 23:56:43 +03:00
parent d2e7b26b26
commit e6309bb6ca

View File

@@ -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() }) });
}),
);