Changed acces road type check and include incomplete
This commit is contained in:
@@ -5,7 +5,7 @@ const Op = sequelize.Op;
|
||||
|
||||
const getSearchRequest = async searchRequestId => {
|
||||
try {
|
||||
console.log("test");
|
||||
|
||||
return await db.SearchRequest.findByPk(searchRequestId);
|
||||
|
||||
} catch (error) {
|
||||
@@ -51,12 +51,13 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
||||
|
||||
const geoSearchQueryPart = sequelize.where(contains, true);
|
||||
|
||||
//WIP This wont work, need to separate queries by adType and realEstateType
|
||||
//because for example flat does not have gardenSize and that can't be in query
|
||||
const query = {
|
||||
adType,
|
||||
realEstateType,
|
||||
subscribed: true,
|
||||
//
|
||||
accessRoadType,
|
||||
balcony,
|
||||
newBuilding,
|
||||
elevator,
|
||||
@@ -113,6 +114,14 @@ const findSearchRequestsForRealEstate = async realEstate => {
|
||||
[Op.gte]: floor
|
||||
};
|
||||
}
|
||||
if (accessRoadType) {
|
||||
query.accessRoadType = {
|
||||
[Op.or]: {
|
||||
[Op.eq]: 'ANY',
|
||||
[Op.eq]: accessRoadType
|
||||
}
|
||||
}
|
||||
}
|
||||
return await db.SearchRequest.findAll({ where: query });
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user