change file names to CamelCase
This commit is contained in:
33
app/controllers/realEstateTypes.js
Normal file
33
app/controllers/realEstateTypes.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const db = require('../models/index');
|
||||
|
||||
const realEstateTypes = [
|
||||
{ ime: "Kuća", id: "kuca" },
|
||||
{ ime: "Stan", id: "stan" },
|
||||
{ ime: "Vikendica", id: "vikendica" }
|
||||
];
|
||||
|
||||
|
||||
const getRealEstateTypes = (req,res) => {
|
||||
const nextStep = req.query.nextStep;
|
||||
res.render('realEstateType', {
|
||||
nextStep,
|
||||
realEstateTypes: realEstateTypes
|
||||
});
|
||||
};
|
||||
|
||||
const postRealEstateTypes = (req, res) => {
|
||||
let nextStep = req.query.nextStep;
|
||||
db.RealEstateRequest.create({
|
||||
realEstateType: req.body.realestatetype
|
||||
}).then( (result) => {
|
||||
nextStep = nextStep || `/grad/${result.uniqueId}`;
|
||||
res.redirect(nextStep);
|
||||
}).catch( (e) => {
|
||||
res.send(e);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getRealEstateTypes,
|
||||
postRealEstateTypes
|
||||
};
|
||||
Reference in New Issue
Block a user