mirror of
https://github.com/myfatemi04/wheelshare-old-backend.git
synced 2025-04-21 12:10:17 -04:00
add posting comments
This commit is contained in:
parent
43a0317a3b
commit
94143bc4fa
|
@ -5,6 +5,26 @@ import requireApiAuth from '../requireApiAuth';
|
||||||
|
|
||||||
export const router = Router();
|
export const router = Router();
|
||||||
|
|
||||||
|
router.post('/:poolID/comment', requireApiAuth, async (req, res) => {
|
||||||
|
const userID = req.session.accountID;
|
||||||
|
const poolID = req.params.poolID;
|
||||||
|
const commentBody = req.body.body;
|
||||||
|
|
||||||
|
await PoolModel.updateOne(
|
||||||
|
{ _id: poolID },
|
||||||
|
{
|
||||||
|
$push: {
|
||||||
|
comments: {
|
||||||
|
author_id: userID,
|
||||||
|
body: commentBody,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
).exec();
|
||||||
|
|
||||||
|
res.json({ status: 'success' });
|
||||||
|
});
|
||||||
|
|
||||||
router.post('/:poolID/join', async (req, res) => {
|
router.post('/:poolID/join', async (req, res) => {
|
||||||
const userID = req.session.accountID;
|
const userID = req.session.accountID;
|
||||||
const poolID = req.params.poolID;
|
const poolID = req.params.poolID;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user