It returns an array. Need to check the tests.

This commit is contained in:
gaba
2016-11-04 14:32:47 -07:00
parent 69980c9d7d
commit 3cff52d72f
+2 -2
View File
@@ -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);
});