remove old request parameters and add location parameter to the review

This commit is contained in:
Bilal Catic
2019-09-10 07:44:43 +02:00
parent af908759bf
commit 13c462f328

View File

@@ -1,10 +1,6 @@
const { currentRERequest } = require("../helpers/url");
const { getRegionName, getMunicipalityName } = require("../helpers/codes");
const {
realEstateTypes,
sizes,
gardenSizes,
prices,
getEnumTypeTitle,
getRealEstateTypeEnum
} = require("../helpers/enums");
@@ -20,14 +16,13 @@ const getQueryReview = async (req, res) => {
const {
realEstateType,
region,
municipality,
sizeMin,
sizeMax,
gardenSizeMin,
gardenSizeMax,
priceMin,
priceMax
priceMax,
locationInput
} = request.dataValues;
const realEstateTypeObject = getRealEstateTypeEnum(realEstateType);
@@ -38,9 +33,9 @@ const getQueryReview = async (req, res) => {
const realEstateTypeTitle = realEstateType
? getEnumTypeTitle(realEstateTypes, realEstateType)
: null;
const regionName = region ? getRegionName(region) : null;
const municipalityName =
region && municipality ? getMunicipalityName(region, municipality) : null;
const locationTitle = locationInput ? locationInput : "-";
const sizeTitle = sizeMin ? sizeMin + "-" + sizeMax + " m2" : null;
const gardenSizeTitle = gardenSizeMin
? gardenSizeMin + "-" + gardenSizeMax + " m2"
@@ -58,14 +53,9 @@ const getQueryReview = async (req, res) => {
url: `/vrstanekretnine/${uniqueId}?nextStep=pregled`
},
{
id: "region",
title: regionName,
url: `/grad/${uniqueId}?nextStep=mjesto`
},
{
id: "municipality",
title: municipalityName,
url: `/mjesto/${uniqueId}?nextStep=pregled`
id: "location",
title: locationTitle,
url: `/lokacija/${uniqueId}?nextStep=pregled`
},
{
id: "size",