mirror of
https://github.com/ash-project/ash_oban.git
synced 2024-09-21 05:43:24 +12:00
2ce62a5770
improvement: support destroy actions in the trigger action improvement: debug logs
45 lines
764 B
Elixir
45 lines
764 B
Elixir
defmodule AshOban.Test.Triggered do
|
|
use Ash.Resource,
|
|
data_layer: Ash.DataLayer.Ets,
|
|
extensions: [AshOban]
|
|
|
|
oban do
|
|
api AshOban.Test.Api
|
|
|
|
triggers do
|
|
trigger :process do
|
|
action :process
|
|
where expr(processed != true)
|
|
worker_read_action(:read)
|
|
end
|
|
|
|
trigger :process_2 do
|
|
action :process
|
|
where expr(processed != true)
|
|
worker_read_action(:read)
|
|
scheduler_cron false
|
|
end
|
|
end
|
|
end
|
|
|
|
actions do
|
|
defaults [:create]
|
|
|
|
read :read do
|
|
primary? true
|
|
pagination keyset?: true
|
|
end
|
|
|
|
update :process do
|
|
change set_attribute(:processed, true)
|
|
end
|
|
end
|
|
|
|
ets do
|
|
private? true
|
|
end
|
|
|
|
attributes do
|
|
uuid_primary_key :id
|
|
end
|
|
end
|