improvement: accept attributes on transfer create

ci: dependabot only weekly
This commit is contained in:
Zach Daniel 2024-06-19 10:00:34 -04:00
parent 1d732a0c6c
commit 2a961a486d
3 changed files with 17 additions and 5 deletions

View file

@ -1,6 +1,12 @@
version: 2 version: 2
updates: updates:
- package-ecosystem: mix - package-ecosystem: mix
directory: "/" directory: "/"
schedule: schedule:
interval: "daily" interval: weekly
day: thursday
groups:
production-dependencies:
dependency-type: production
dev-dependencies:
dependency-type: development

View file

@ -18,6 +18,10 @@ defmodule AshDoubleEntry.Transfer do
balance_resource: [ balance_resource: [
type: {:spark, Ash.Resource}, type: {:spark, Ash.Resource},
doc: "The resource being used for balances" doc: "The resource being used for balances"
],
create_accept: [
type: {:wrap_list, :atom},
doc: "Additional attributes to accept when creating a transfer"
] ]
] ]
} }

View file

@ -38,7 +38,9 @@ defmodule AshDoubleEntry.Transfer.Transformers.AddStructure do
attribute_writable?: true attribute_writable?: true
) )
|> Ash.Resource.Builder.add_action(:create, :transfer, |> Ash.Resource.Builder.add_action(:create, :transfer,
accept: [:amount, :timestamp, :from_account_id, :to_account_id] accept:
[:amount, :timestamp, :from_account_id, :to_account_id] ++
AshDoubleEntry.Transfer.Info.transfer_create_accept!(dsl)
) )
|> Ash.Resource.Builder.add_action(:read, :read_transfers, |> Ash.Resource.Builder.add_action(:read, :read_transfers,
pagination: Ash.Resource.Builder.build_pagination(keyset?: true) pagination: Ash.Resource.Builder.build_pagination(keyset?: true)