mirror of
https://github.com/wassname/talk.git
synced 2026-07-09 23:12:09 +08:00
Returning usernames.
This commit is contained in:
@@ -17,6 +17,7 @@ const CommentSchema = new Schema({
|
||||
},
|
||||
asset_id: String,
|
||||
author_id: String,
|
||||
username: String,
|
||||
status: {
|
||||
type: String,
|
||||
enum: ['accepted', 'rejected', ''],
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user