clean code

This commit is contained in:
Bilal Catic
2019-05-16 19:58:48 +02:00
parent c505062770
commit 1542310a81
9 changed files with 52 additions and 54 deletions

View File

@@ -1,25 +1,24 @@
const db = require('../models/index');
const { currentRERequest } = require('../helpers/url');
const { currentRERequest } = require('../helpers/url');
const { places } = require('../helpers/codes');
const getNeighborhood = async (req,res) => {
let request = await currentRERequest(req);
const neighborhoods = places(request.city);
const nextStep = req.query.nextStep || '/';
res.render('neighborhood', {
nextStep,
neighborhoods
res.render('neighborhood', {
nextStep,
neighborhoods
});
}
};
const postgNeighborhood = async (req, res) => {
let request = await currentRERequest(req);
request.neighborhood = req.body.neighborhood;
await request.save();
res.send("Result is " + JSON.stringify(request));
}
res.send("Result is " + JSON.stringify(request));
};
module.exports = {
module.exports = {
getNeighborhood,
postgNeighborhood
};

View File

@@ -6,7 +6,6 @@ const realEstateTypes = [
{ ime: "Vikendica", id: "vikendica" }
];
const getRealEstateTypes = (req,res) => {
const nextStep = req.query.nextStep;
res.render('realEstateType', {

View File

@@ -1,7 +1,7 @@
const getWelcome = (req,res) => {
res.render('welcome', { nextStep: '/vrstanekretnine' } );
}
};
module.exports = {
module.exports = {
getWelcome
};