From 0e1e04d2a9cff57b5b95376bc0a66dd383f16652 Mon Sep 17 00:00:00 2001 From: David Jay Date: Mon, 7 Nov 2016 16:19:20 -0500 Subject: [PATCH] Returning usernames. --- models/comment.js | 1 + routes/api/comments/index.js | 4 ++-- routes/api/stream/index.js | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/models/comment.js b/models/comment.js index 644ffb6d0..74e9aa059 100644 --- a/models/comment.js +++ b/models/comment.js @@ -17,6 +17,7 @@ const CommentSchema = new Schema({ }, asset_id: String, author_id: String, + username: String, status: { type: String, enum: ['accepted', 'rejected', ''], diff --git a/routes/api/comments/index.js b/routes/api/comments/index.js index 57c434a6f..a19865964 100644 --- a/routes/api/comments/index.js +++ b/routes/api/comments/index.js @@ -30,7 +30,8 @@ router.post('/', (req, res, next) => { author_id: req.body.author_id, asset_id: req.body.asset_id, parent_id: req.body.parent_id, - status: req.body.status + status: req.body.status, + username: req.body.username }); comment.save().then(({id}) => { res.status(200).send(id); @@ -46,7 +47,6 @@ router.post('/:comment_id', (req, res, next) => { comment.asset_id = req.body.asset_id; comment.parent_id = req.body.parent_id; comment.status = req.body.status; - comment.username = req.body.username; comment.save().then((comment) => { res.status(200).send(comment); diff --git a/routes/api/stream/index.js b/routes/api/stream/index.js index 5c3333ac8..c63bf871d 100644 --- a/routes/api/stream/index.js +++ b/routes/api/stream/index.js @@ -17,7 +17,6 @@ router.get('/', (req, res, next) => { Action.findByItemIdArray(comments.map((comment) => comment.id)) ]); }).then(([comments, users, actions]) => { - console.log(comments.length); res.json([...comments,...users,...actions]); }).catch(error => { next(error);