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/mandal.controller.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 interface/controllers/mandal.controller.js (limited to 'interface/controllers/mandal.controller.js') diff --git a/interface/controllers/mandal.controller.js b/interface/controllers/mandal.controller.js new file mode 100644 index 0000000..43842fe --- /dev/null +++ b/interface/controllers/mandal.controller.js @@ -0,0 +1,16 @@ +const db = require("../models"); +const mandal = db.mandal_master; + + +exports.allMandals = () => { + return mandal.findAll({ + attributes: ['mandal_id', 'mandal_name'] + }) +}; + + +exports.allMandalsByDistrictId = (district_id) => { + const query =`SELECT * FROM mandal_master WHERE district_id = ${district_id}`; + return db.sequelize.query(query, { type: db.sequelize.QueryTypes.SELECT }); + +}; -- cgit v1.2.3