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/district.controller.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 interface/controllers/district.controller.js (limited to 'interface/controllers/district.controller.js') diff --git a/interface/controllers/district.controller.js b/interface/controllers/district.controller.js new file mode 100644 index 0000000..5b21530 --- /dev/null +++ b/interface/controllers/district.controller.js @@ -0,0 +1,19 @@ +const db = require("../models"); +const district = db.district_master; + +exports.allDistricts = () => { + return district.findAll({ + attributes: ['district_id', 'district_name'] + }) +}; + + +exports.allDistrictsByStateId = (state_id) => { + const query =`SELECT * FROM district_master WHERE state_id = ${state_id}`; + return db.sequelize.query(query, { type: db.sequelize.QueryTypes.SELECT }); +}; + + + + + -- cgit v1.2.3