|
|
|
@ -59,7 +59,7 @@ router.post('/commandeCrepe', async function (req, res) { |
|
|
|
}) |
|
|
|
|
|
|
|
router.post('/submitResolution/:postId', upload.single('image'), async function (req, res) { |
|
|
|
const postId = req.params.postId; |
|
|
|
const postId = req.params.postId; // Assuming postId is obtained from the request
|
|
|
|
const resolutionData = req.body; |
|
|
|
const enteredDescription = resolutionData.description; |
|
|
|
const user = req.session.user; |
|
|
|
@ -69,15 +69,20 @@ router.post('/submitResolution/:postId', upload.single('image'), async function |
|
|
|
const path = file.path; |
|
|
|
|
|
|
|
const resolution = { |
|
|
|
description: enteredDescription, |
|
|
|
nom: nom, |
|
|
|
prenom: prenom, |
|
|
|
imagePath: path |
|
|
|
} |
|
|
|
|
|
|
|
await db.getDb().collection('posts').updateOne() |
|
|
|
|
|
|
|
return res.redirect('/hotLine'); |
|
|
|
}); |
|
|
|
postId: postId, |
|
|
|
description: enteredDescription, |
|
|
|
nom: nom, |
|
|
|
prenom: prenom, |
|
|
|
imagePath: path |
|
|
|
} |
|
|
|
|
|
|
|
const filter = {id: postId}; |
|
|
|
const updateDoc = { |
|
|
|
$set: {[`resolutions.${postId}`]: resolution} |
|
|
|
}; |
|
|
|
|
|
|
|
const result = await db.getDb().collection('res').insertOne(resolution); |
|
|
|
return res.redirect('/hotLine') |
|
|
|
}) |
|
|
|
|
|
|
|
module.exports = router; |