docs: add required pagination to tutorial (#11)

---------

Co-authored-by: Zach Daniel <zachary.s.daniel@gmail.com>
This commit is contained in:
Johnny Mejias 2024-01-02 09:37:57 -04:00 committed by GitHub
parent b9aa9239a8
commit b00f2f6b75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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