Added migration and model change for searchReq table.

This commit is contained in:
Naida Vatric
2020-01-23 10:12:56 +01:00
parent d117383802
commit 5b3491fdba
5 changed files with 41 additions and 3 deletions

1
.prettierignore Normal file
View File

@@ -0,0 +1 @@
*.ejs

View File

@@ -35,7 +35,8 @@ const getFilters = async (req, res) => {
balcony,
elevator,
newBuilding,
accessRoadType
accessRoadType,
includeWithoutPrice
} = searchRequest;
const category = AD_CATEGORY[realEstateType] || AD_CATEGORY.FLAT;
@@ -115,7 +116,8 @@ const getFilters = async (req, res) => {
advancedSegmentSelectFilterValues,
advancedRangeFilterObjects,
advancedRangeFilterValues,
includeIncompleteAds
includeIncompleteAds,
includeWithoutPrice
});
};
@@ -191,6 +193,7 @@ const postFilters = async (req, res) => {
});
const includeIncompleteAds = req.body.includeIncompleteAds === "on";
const includeWithoutPrice = req.body.includeWithoutPrice === "on";
const balcony = req.body.balcony === "on";
const elevator = req.body.elevator === "on";
@@ -217,6 +220,7 @@ const postFilters = async (req, res) => {
searchRequest.newBuilding = newBuilding;
searchRequest.includeIncompleteAds = includeIncompleteAds;
searchRequest.includeWithoutPrice = includeWithoutPrice;
searchRequest.accessRoadType = accessRoadType;

View File

@@ -0,0 +1,14 @@
"use strict";
module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.addColumn("SearchRequests", "includeWithoutPrice", {
type: Sequelize.BOOLEAN,
defaultValue: false
});
},
down: (queryInterface, Sequelize) => {
return queryInterface.removeColumn("SearchRequests", "includeWithoutPrice");
}
};

View File

@@ -15,7 +15,15 @@ module.exports = (sequelize, DataTypes) => {
allowNull: false,
defaultValue: {
type: "Polygon",
coordinates: [[[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]],
coordinates: [
[
[0, 0],
[0, 0],
[0, 0],
[0, 0],
[0, 0]
]
],
crs: { type: "name", properties: { name: "EPSG:4326" } }
}
},
@@ -71,6 +79,7 @@ module.exports = (sequelize, DataTypes) => {
type: DataTypes.TEXT
},
includeIncompleteAds: DataTypes.BOOLEAN,
includeWithoutPrice: DataTypes.BOOLEAN,
balcony: DataTypes.BOOLEAN,
elevator: DataTypes.BOOLEAN,
newBuilding: DataTypes.BOOLEAN,

View File

@@ -18,6 +18,16 @@
</div>
</div>
<br />
<p class="distinguished">
<label class="checkbox-label">
<input type="checkbox" class="filled-in" name="includeWithoutPrice"
<% if (includeWithoutPrice) { %>
checked
<% } %>>
<span>Uključi i oglase bez cijene</span>
</label>
</p>
<br />
<div class="row center-align">