adapt price and query review steps for new DB design
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const { currentRERequest } = require("../helpers/url");
|
||||
const { currentSearchRequest } = require("../helpers/url");
|
||||
|
||||
const getPrice = (req, res) => {
|
||||
const title = "Koja Vam okvirna cijena odgovara ?";
|
||||
@@ -22,14 +22,17 @@ const getPrice = (req, res) => {
|
||||
};
|
||||
|
||||
const postPrice = async (req, res) => {
|
||||
const request = await currentRERequest(req);
|
||||
const searchRequest = await currentSearchRequest(req);
|
||||
|
||||
const nextStepPage = req.query.nextStep || "pregled";
|
||||
const nextStepUrl = `/${nextStepPage}/${request.uniqueId}`;
|
||||
const nextStepUrl = `/${nextStepPage}/${searchRequest.id}`;
|
||||
const priceMin = req.body.from || 0;
|
||||
const priceMax = req.body.to || 0;
|
||||
//TODO: price validation
|
||||
|
||||
request.priceMin = req.body.from;
|
||||
request.priceMax = req.body.to;
|
||||
await request.save();
|
||||
searchRequest.priceMin = priceMin;
|
||||
searchRequest.priceMax = priceMax;
|
||||
await searchRequest.save();
|
||||
|
||||
res.redirect(nextStepUrl);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user