WiP - changed db helpers
This commit is contained in:
@@ -43,6 +43,11 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
||||
adType,
|
||||
realEstateType,
|
||||
subscribed: true,
|
||||
//
|
||||
accessRoadType,
|
||||
balcony,
|
||||
newBuilding,
|
||||
elevator,
|
||||
[Op.and]: geoSearchQueryPart
|
||||
};
|
||||
|
||||
@@ -63,7 +68,39 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
||||
[Op.gte]: area
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
if (gardenSize) {
|
||||
query.gardenSizeMin = {
|
||||
[Op.lte]: gardenSize
|
||||
};
|
||||
query.gardenSizeMax = {
|
||||
[Op.gte]: gardenSize
|
||||
};
|
||||
}
|
||||
if (numberOfRooms) {
|
||||
query.numberOfRoomsMin = {
|
||||
[Op.lte]: numberOfRooms
|
||||
};
|
||||
query.numberOfRoomsMax = {
|
||||
[Op.gte]: numberOfRooms
|
||||
};
|
||||
}
|
||||
if (numberOfFloors) {
|
||||
query.numberOfFloorsMin = {
|
||||
[Op.lte]: numberOfFloors
|
||||
};
|
||||
query.numberOfFloorsMax = {
|
||||
[Op.gte]: numberOfFloors
|
||||
};
|
||||
}
|
||||
if (floor) {
|
||||
query.floorMin = {
|
||||
[Op.lte]: floor
|
||||
};
|
||||
query.floorMax = {
|
||||
[Op.gte]: floor
|
||||
};
|
||||
}
|
||||
return await db.SearchRequest.findAll({ where: query });
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user