diff options
| author | jmreddy2106 <[email protected]> | 2022-05-03 18:29:31 -0400 |
|---|---|---|
| committer | jmreddy2106 <[email protected]> | 2022-05-03 18:29:31 -0400 |
| commit | b861c79f03429313d05ff0a8105b7715aec0ef4d (patch) | |
| tree | b0dcfa8cbf2cc5ce3fda7af854c1ce84ff053cf2 /interface/routes/api/citizens.js | |
| parent | f807467dca2f08060b0bd4aa6b30ed231bb383b7 (diff) | |
| download | Welfare-Schemes-DMQL-b861c79f03429313d05ff0a8105b7715aec0ef4d.tar.xz Welfare-Schemes-DMQL-b861c79f03429313d05ff0a8105b7715aec0ef4d.zip | |
added geography controls
Diffstat (limited to 'interface/routes/api/citizens.js')
| -rw-r--r-- | interface/routes/api/citizens.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/interface/routes/api/citizens.js b/interface/routes/api/citizens.js index bab5222..6dad084 100644 --- a/interface/routes/api/citizens.js +++ b/interface/routes/api/citizens.js @@ -18,4 +18,38 @@ router.post('/edit', (req, res) => { } }); + +router.post('/delete', (req, res) => { + const { citizen_id } = req.body; + if (!citizen_id) { + res.status(400).json({ message: "Please fill in all fields" }); + } else { + citizensController.deleteCitizenbyId(citizen_id) + .then(() => { + res.status(200).json({ message: "Citizen deleted successfully" }); + }) + .catch((err) => { + res.status(400).json({ message: err }); + }); + } +} ); + + +router.post('/validate', (req, res) => { + const { citizen_id } = req.body; + if (!citizen_id) { + res.status(400).json({ message: "Please fill in all fields" }); + } else { + citizensController.checkCitizenId(citizen_id) + .then(( isValid ) => { + res.status(200).json({ isValid: !isValid }); + } + ) + .catch((err) => { + res.status(400).json({ message: err }); + }); + } +}); + + module.exports = router;
\ No newline at end of file |
