defmodule CompaniesRegEx.Resources.Recruiters do
use Ash.Resource, data_layer: AshPostgres.DataLayer
import AshGeo.Postgis
actions do
defaults [:create, :read, :update, :destroy]
action :create_loc do
argument :location, :geo_any
change set_attribute(:location, arg(:location))
end
read :containing do
argument :location, :geo_any do
allow_nil? false
constraints geo_types: :point
end
filter expr(^st_within(^arg(:location), location))
end
end
attributes do
# Add an autogenerated UUID primary key called `:id`.
uuid_primary_key :id
attribute :location, :geometry
end
end
defmodule CompaniesRegEx.Resources.Recruiters do
use Ash.Resource, data_layer: AshPostgres.DataLayer
import AshGeo.Postgis
actions do
defaults [:create, :read, :update, :destroy]
action :create_loc do
argument :location, :geo_any
change set_attribute(:location, arg(:location))
end
read :containing do
argument :location, :geo_any do
allow_nil? false
constraints geo_types: :point
end
filter expr(^st_within(^arg(:location), location))
end
end
attributes do
# Add an autogenerated UUID primary key called `:id`.
uuid_primary_key :id
attribute :location, :geometry
end
end