diff options
| author | Bobby <[email protected]> | 2022-05-03 15:25:08 -0400 |
|---|---|---|
| committer | Bobby <[email protected]> | 2022-05-03 15:25:08 -0400 |
| commit | 45ed5c37a3ec4155616334b7e09a2c1679b3fb52 (patch) | |
| tree | 3dc99b4bbcc850f2fae402126ceeda413096ff7e /interface/routes/api | |
| parent | 40eac9bcc99f0dc0139a9356464df66e9cf5c7dc (diff) | |
| download | Welfare-Schemes-DMQL-45ed5c37a3ec4155616334b7e09a2c1679b3fb52.tar.xz Welfare-Schemes-DMQL-45ed5c37a3ec4155616334b7e09a2c1679b3fb52.zip | |
working edit
Diffstat (limited to 'interface/routes/api')
| -rw-r--r-- | interface/routes/api/citizens.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/interface/routes/api/citizens.js b/interface/routes/api/citizens.js new file mode 100644 index 0000000..bab5222 --- /dev/null +++ b/interface/routes/api/citizens.js @@ -0,0 +1,21 @@ +const express = require("express"); +const router = express.Router(); + +const citizensController = require("../../controllers/citizens.controller"); + +router.post('/edit', (req, res) => { + const { citizen_id, address, mobile_num, dob, marital_status } = req.body; + if (!citizen_id || !address || !mobile_num || !dob || !marital_status) { + res.status(400).json({ message: "Please fill in all fields" }); + } else { + citizensController.editCitizen(citizen_id, address, mobile_num, dob, marital_status) + .then(() => { + res.status(200).json({ message: "Citizen updated successfully" }); + }) + .catch((err) => { + res.status(400).json({ message: err }); + }); + } +}); + +module.exports = router;
\ No newline at end of file |
