From 3cff52d72f9fab4d0360e78c217f40957f7e02a3 Mon Sep 17 00:00:00 2001 From: gaba Date: Fri, 4 Nov 2016 14:32:47 -0700 Subject: [PATCH] It returns an array. Need to check the tests. --- routes/api/stream/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/api/stream/index.js b/routes/api/stream/index.js index ba35b4138..1bbe259e4 100644 --- a/routes/api/stream/index.js +++ b/routes/api/stream/index.js @@ -8,12 +8,12 @@ const router = express.Router(); router.get('/', (req, res, next) => { - const comments = Comment.findByAssetId(req.query.asset_id) || []; + const comments = Comment.findByAssetId(req.query.asset_id); const users = User.findByIdArray(comments.map((comment) => comment.author_id)); const actions = Action.findByItemIdArray(comments.map((comment) => comment.id)); Promise.all([comments, users, actions]).then(([comments, users, actions]) => { - res.json(...comments,...users,...actions); + res.json([...comments,...users,...actions]); }).catch(error => { next(error); });