mirror of
https://github.com/wassname/talk.git
synced 2026-07-08 07:46:34 +08:00
It returns an array. Need to check the tests.
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user