abeeshake456
abeeshake456
AEAsh Elixir
Created by abeeshake456 on 7/31/2023 in #support
help with ash_geo for using locations.
Resource definition looks like
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
The error seems to be
Compiling 2 files (.ex)

== Compilation error in file lib/companies_reg_ex/resources/recruiters.ex ==
** (CompileError) lib/companies_reg_ex/resources/recruiters.ex:34: undefined function change/1 (there is no such import)
(ash 2.13.2) expanding macro: Ash.Resource.Dsl.Actions.Action.action/2
Compiling 2 files (.ex)

== Compilation error in file lib/companies_reg_ex/resources/recruiters.ex ==
** (CompileError) lib/companies_reg_ex/resources/recruiters.ex:34: undefined function change/1 (there is no such import)
(ash 2.13.2) expanding macro: Ash.Resource.Dsl.Actions.Action.action/2
when I add import Ash.Expr above, I get
(CompileError) lib/companies_reg_ex/resources/recruiters.ex:29: function expr/1 imported from both Ash.Filter.TemplateHelpers and Ash.Expr, call is ambiguous
(CompileError) lib/companies_reg_ex/resources/recruiters.ex:29: function expr/1 imported from both Ash.Filter.TemplateHelpers and Ash.Expr, call is ambiguous
17 replies
AEAsh Elixir
Created by abeeshake456 on 6/7/2023 in #support
implementing state_timeout in AshStateMachine
Just had a look at https://github.com/ash-project/ash_state_machine/blob/v0.1.4/test/ash_state_machine_test.exs Is there an option similar to :state_timeout from https://www.erlang.org/doc/man/gen_statem.html#type-timeout_event_type The use case is - if one state doesn't get a new transition within :state_timeout seconds, it doesn't keep waiting forever
10 replies
AEAsh Elixir
Created by abeeshake456 on 4/19/2023 in #support
guide for using Ash.Flow and multi step user flow with retries.
Hi Jack. Thanks for the good work you have put so far.
I was looking at Ash.Flow and the step DSL feels what i Might need. Here is the Use case in detail: A student submits his solution (let's call it submission) on a portal. The administrator / staff then assigns that to a teacher. The teacher evaluates the submission and submits back to the portal. Staff approves of the evaluation submitted by teacher. Student can then see the evaluated submission. At any time, staff can cancel the submission assigned to the teacher. Staff can then re-assign it to any other teacher. If any teacher does not evaluate the submission for 3 days, staff is notified. Teacher can refuse to evaluate the assigned submission. This Flow can span several days. 1. Is Ash.Flow a good use case for this? In short, i need steps that are more like a gen state machine. I could sketch a rough diagram if that helps.
9 replies