From bbff526ea089c16aeeaaf65e8d103a1be267a677 Mon Sep 17 00:00:00 2001 From: Bilal Catic Date: Mon, 30 Sep 2019 14:27:26 +0200 Subject: [PATCH] skip real estates without location in search --- app/helpers/db/searchRequest.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/helpers/db/searchRequest.js b/app/helpers/db/searchRequest.js index a136915..08e8922 100644 --- a/app/helpers/db/searchRequest.js +++ b/app/helpers/db/searchRequest.js @@ -21,6 +21,10 @@ const findSearchRequestsForRealEstate = async realEstate => { locationLong } = realEstate; + if (!locationLat || !locationLong) { + return []; + } + const stGeometry = sequelize.fn( "ST_GEOMFROMTEXT", `POINT (${locationLong} ${locationLat})`,