From b861c79f03429313d05ff0a8105b7715aec0ef4d Mon Sep 17 00:00:00 2001 From: jmreddy2106 Date: Tue, 3 May 2022 18:29:31 -0400 Subject: added geography controls --- interface/controllers/citizens.controller.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'interface/controllers/citizens.controller.js') diff --git a/interface/controllers/citizens.controller.js b/interface/controllers/citizens.controller.js index ee9355b..0ee1d42 100644 --- a/interface/controllers/citizens.controller.js +++ b/interface/controllers/citizens.controller.js @@ -15,6 +15,15 @@ exports.findXCitizens = () => { return sequelize.query(query, { type: QueryTypes.SELECT }) }; + +exports.deleteCitizenbyId = (citizen_id) =>{ + + return citizens.destroy({ + where: { citizen_id } + }) + +}; + exports.editCitizen = (citizen_id, address, mobile_num, dob, marital_status) => { return citizens.update({ address, mobile_num, dob, marital_status @@ -25,6 +34,23 @@ exports.editCitizen = (citizen_id, address, mobile_num, dob, marital_status) => }); }; +//Check Citizen exists or not +exports.checkCitizenId = (citizen_id) => { + return citizens.findOne({ + where: { + citizen_id + } + }).then( + citizen_id => { + if (citizen_id) { + return true; + } + return false; + } + ) +} + + // Get total number of male and female citizens exports.findGenderDistribution = () => { // group by the 'gender' column -- cgit v1.2.3