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);