Update deps
This commit is contained in:
@@ -13,7 +13,7 @@ defmodule Eventos.Addresses.Address do
|
||||
field(:addressRegion, :string)
|
||||
field(:description, :string)
|
||||
field(:floor, :string)
|
||||
field(:geom, Geo.Geometry)
|
||||
field(:geom, Geo.PostGIS.Geometry)
|
||||
field(:postalCode, :string)
|
||||
field(:streetAddress, :string)
|
||||
has_one(:event, Event)
|
||||
|
||||
@@ -78,17 +78,17 @@ defmodule Eventos.Events do
|
||||
|
||||
# 50 000 meters -> 50 kms
|
||||
def find_close_events(lon, lat, radius \\ 50_000) do
|
||||
ip_point = Geo.WKT.decode("SRID=4326;POINT(#{lon} #{lat})")
|
||||
|
||||
Repo.all(
|
||||
from(
|
||||
e in Event,
|
||||
join: a in Address,
|
||||
on: a.id == e.physical_address_id,
|
||||
where: st_dwithin_in_meters(^ip_point, a.geom, ^radius),
|
||||
preload: :organizer_actor
|
||||
with {:ok, ip_point} <- Geo.WKT.decode("SRID=4326;POINT(#{lon} #{lat})") do
|
||||
Repo.all(
|
||||
from(
|
||||
e in Event,
|
||||
join: a in Address,
|
||||
on: a.id == e.physical_address_id,
|
||||
where: st_dwithin_in_meters(^ip_point, a.geom, ^radius),
|
||||
preload: :organizer_actor
|
||||
)
|
||||
)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@doc """
|
||||
|
||||
Reference in New Issue
Block a user