From 7051c250ba6e1879e5b19c993bf38e8745740706 Mon Sep 17 00:00:00 2001 From: Bobby Date: Tue, 3 May 2022 20:55:34 -0400 Subject: citizen adding working --- interface/controllers/district.controller.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'interface/controllers/district.controller.js') diff --git a/interface/controllers/district.controller.js b/interface/controllers/district.controller.js index 5b21530..468d5fb 100644 --- a/interface/controllers/district.controller.js +++ b/interface/controllers/district.controller.js @@ -10,10 +10,10 @@ exports.allDistricts = () => { 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 }); + return db.sequelize.query(query, { type: db.sequelize.QueryTypes.SELECT }).then(districts => { + if (districts) { + return districts; + } + return null; + }); }; - - - - - -- cgit v1.2.3