Code refactoring, fixed bug with price parsing:

This commit is contained in:
Nedim Uka
2019-06-24 14:20:31 +02:00
parent 6eba5c2a97
commit 2cf6f6f1ff
3 changed files with 37 additions and 26 deletions

View File

@@ -1,10 +1,15 @@
const db = require('../../models/index');
// const db = require('../../models/index');
// TODO Fetch only subscribed realestate requests
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]+ ")\'))");
}
// const bulkInsert = async (reuslts) => {
// db.MarketAlert.bulkCreate({
// })
// }
module.exports = {
allRERequest,
findPointInsideBoundingBox
};