aboutsummaryrefslogtreecommitdiff
path: root/interface/controllers/mandal.controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'interface/controllers/mandal.controller.js')
-rw-r--r--interface/controllers/mandal.controller.js16
1 files changed, 16 insertions, 0 deletions
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 });
+
+};