Olix crawling, filter crawling result by lat, lng

This commit is contained in:
Nedim Uka
2019-06-19 17:12:22 +02:00
parent 9a8a27d1d9
commit 0f630e9ea4
6 changed files with 777 additions and 682 deletions

View File

@@ -8,6 +8,16 @@ const currentRERequest = async (req) => {
return request;
};
const allRERequest = async () => {
return await db.RealEstateRequest.findAll();
}
const findPointInsideBoundingBox = async (latLng) => {
return await db.sequelize.query("SELECT * FROM \"RealEstateRequests\" WHERE ST_Contains(\"RealEstateRequests\".bounding_box, ST_GEOMFROMTEXT(\'POINT (" + latLng[0] + " " + latLng[1]+ ")\'))");
}
module.exports = {
currentRERequest
currentRERequest,
allRERequest,
findPointInsideBoundingBox
};