mirror of
https://github.com/Priyatham-sai-chand/Locaft-backend.git
synced 2026-10-05 08:51:33 -07:00
pricing update backend
This commit is contained in:
parent
d933dd2256
commit
ced7d230e9
1 changed files with 23 additions and 0 deletions
|
|
@ -109,5 +109,28 @@ router.get("/", auth, async (req, res) => {
|
||||||
id: user._id,
|
id: user._id,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
router.put("/update", async (req, res) => {
|
||||||
|
const { email,pricing } = req.body;
|
||||||
|
const existingUser = await User.findOne({ email: email });
|
||||||
|
|
||||||
|
|
||||||
|
if (!existingUser) {
|
||||||
|
return res.status(400).json({ Msg: "Not all fields have been entered." });
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
User.findByIdAndUpdate({ _id: existingUser._id }, { pricing: pricing }).then(() => {
|
||||||
|
User.findOne({ email: email }).then((user) => {
|
||||||
|
res.send(user);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
Loading…
Reference in a new issue