Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
bensonarafat committed Oct 16, 2023
1 parent e0104fb commit 6ed11e1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions src/controllers/state.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,22 @@ const State = model.stateModel;
}

stateController.towns = async (req, res) => {
let state_code = req.params.status_code;
let state_code = req.params.state_code;
try {
let _state = await State.findOne({state_code : state_code}).exec();
let _state = await State.find({state_code : state_code}).exec();
let towns = _state['towns'];
if(towns){
res.status(200).json(towns)
}else{
res.status(200).json({message: `Town is Empty. We are open to contributions at ${constants.SERVER.APP_URL}. Thank you!`});
}
} catch (_) {
res.status(500).json({message: "Server Error"});
res.status(500).json({message: "Server Error", state_code});
}
}

stateController.lgas = async (req, res) => {
let state_code = req.params.status_code;
let state_code = req.params.state_code;
try {
let _state = await State.findOne({state_code : state_code}).exec();
let lgas = _state['lgas'];
Expand All @@ -81,7 +81,7 @@ const State = model.stateModel;
}
}
stateController.resources = async (req, res) => {
let state_code = req.params.status_code;
let state_code = req.params.state_code;
try {
let _state = await State.findOne({state_code : state_code}).exec();
let resources = _state['national_resources'];
Expand All @@ -96,7 +96,7 @@ const State = model.stateModel;
}

stateController.politics = async (req, res) => {
let state_code = req.params.status_code;
let state_code = req.params.state_code;
try {
let _state = await State.findOne({state_code : state_code}).exec();
let politics = _state['politics'];
Expand All @@ -111,7 +111,7 @@ stateController.politics = async (req, res) => {
}

stateController.universities = async (req, res) => {
let state_code = req.params.status_code;
let state_code = req.params.state_code;
try {
let _state = await State.findOne({state_code : state_code}).exec();
let universities = _state['universities'];
Expand All @@ -126,7 +126,7 @@ stateController.universities = async (req, res) => {
}

stateController.polytechnics = async (req, res) => {
let state_code = req.params.status_code;
let state_code = req.params.state_code;
try {
let _state = await State.findOne({state_code : state_code}).exec();
let polytechnics = _state['polytechnics'];
Expand All @@ -141,7 +141,7 @@ stateController.polytechnics = async (req, res) => {
}

stateController.airports = async (req, res) => {
let state_code = req.params.status_code;
let state_code = req.params.state_code;
try {
let _state = await State.findOne({state_code : state_code}).exec();
let airports = _state['airports'];
Expand All @@ -156,7 +156,7 @@ stateController.airports = async (req, res) => {
}

stateController.hospitals = async (req, res) => {
let state_code = req.params.status_code;
let state_code = req.params.state_code;
try {
let _state = await State.findOne({state_code : state_code}).exec();
let hospitals = _state['hospitals'];
Expand All @@ -171,7 +171,7 @@ stateController.hospitals = async (req, res) => {
}

stateController.languages = async (req, res) => {
let state_code = req.params.status_code;
let state_code = req.params.state_code;
try {
let _state = await State.findOne({state_code : state_code}).exec();
let languages = _state['languages'];
Expand All @@ -186,7 +186,7 @@ stateController.languages = async (req, res) => {
}

stateController.ethnicity = async (req, res) => {
let state_code = req.params.status_code;
let state_code = req.params.state_code;
try {
let _state = await State.findOne({state_code : state_code}).exec();
let ethnic_groups = _state['ethnic_groups'];
Expand All @@ -201,7 +201,7 @@ stateController.ethnicity = async (req, res) => {
}

stateController.religion = async (req, res) => {
let state_code = req.params.status_code;
let state_code = req.params.state_code;
try {
let _state = await State.findOne({state_code : state_code}).exec();
let religions = _state['religions'];
Expand Down
2 changes: 1 addition & 1 deletion src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let SERVER = {
GOOGLE_API_KEY : '',
COUNTRY_CODE : '+234',
DOMAIN_URL : 'http://localhost:8000/',
APP_URL: 'https://vercel.com',
APP_URL: 'https://nigeria-locality.vercel.app/',
CONTACT_EMAIL : '[email protected]',
PRIVILEGES: ["READ", "WRITE"],
ISACTIVE: [
Expand Down

0 comments on commit 6ed11e1

Please sign in to comment.