First review changes: applied prettier, ternary and changed accesRoadType filter

This commit is contained in:
Naida Vatric
2019-12-17 11:18:58 +01:00
parent 5a2fdb7291
commit c672b3ab9f
5 changed files with 94 additions and 77 deletions

View File

@@ -5,11 +5,9 @@ const Op = sequelize.Op;
const getSearchRequest = async searchRequestId => {
try {
return await db.SearchRequest.findByPk(searchRequestId);
} catch (error) {
console.log("searchrequest.js",error);
console.log("searchrequest.js", error);
return null;
}
};
@@ -116,30 +114,30 @@ const findSearchRequestsForRealEstate = async realEstate => {
if (accessRoadType) {
query.accessRoadType = {
[Op.or]: {
[Op.eq]: 'ANY',
[Op.eq]: "ANY",
[Op.eq]: accessRoadType
}
}
};
}
if (balcony) {
query.balcony = {
[Op.eq]: balcony
}
};
}
if (newBuilding) {
query.newBuilding = {
[Op.eq]: newBuilding
}
};
}
if (elevator) {
query.elevator = {
[Op.eq]: elevator
}
};
}
return await db.SearchRequest.findAll({ where: query });
};