16 lines
498 B
JavaScript
16 lines
498 B
JavaScript
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]+ ")\'))");
|
|
}
|
|
|
|
module.exports = {
|
|
allRERequest,
|
|
findPointInsideBoundingBox
|
|
};
|