-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update docs to remove bad example
improvement: support destroy actions in the trigger action improvement: debug logs
- Loading branch information
1 parent
776eec9
commit 2ce62a5
Showing
6 changed files
with
118 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
defmodule AshOban.Test.Api do | ||
use Ash.Api | ||
|
||
resources do | ||
allow_unregistered? true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
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 |