mirror of
https://github.com/ash-project/ash_double_entry.git
synced 2024-09-19 13:03:19 +12:00
docs: add required pagination to tutorial (#11)
--------- Co-authored-by: Zach Daniel <zachary.s.daniel@gmail.com>
This commit is contained in:
parent
b9aa9239a8
commit
b00f2f6b75
1 changed files with 9 additions and 0 deletions
|
@ -121,6 +121,14 @@ defmodule YourApp.Ledger.Balance do
|
|||
account_resource YourApp.Ledger.Account
|
||||
end
|
||||
|
||||
actions do
|
||||
read :read do
|
||||
primary? true
|
||||
# configure keyset pagination for streaming
|
||||
pagination keyset?: true, required?: false
|
||||
end
|
||||
end
|
||||
|
||||
changes do
|
||||
# add custom behavior. In this case, we're preventing certain balances from being less than zero
|
||||
change after_action(&validate_balance/2)
|
||||
|
@ -155,6 +163,7 @@ end
|
|||
- Adds the following actions:
|
||||
- a primary read action called `:read`, if a priamry read action doesn't
|
||||
exist
|
||||
- configure primary read action to have keyset pagination enabled
|
||||
- a create action caleld `:upsert_balance`, which will create or update the relevant balance, by `transfer_id` and `account_id`
|
||||
- Adds an identity that ensures that `account_id` and `transfer_id` are unique
|
||||
|
||||
|
|
Loading…
Reference in a new issue