Files
old-web/app/helpers/db/dbHelper.js

16 lines
498 B
JavaScript
Raw Normal View History

const db = require('../../models/index');
2019-06-20 14:51:14 +02:00
// TODO Fetch only subscribed realestate requests
const allRERequest = async () => {
return await db.RealEstateRequest.findAll();
}
2019-06-20 14:51:14 +02:00
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]+ ")\'))");
}
2019-06-20 14:51:14 +02:00
module.exports = {
allRERequest,
findPointInsideBoundingBox
};