ash_double_entry/lib/account/account.ex

43 lines
1.1 KiB
Elixir
Raw Normal View History

2023-07-22 12:27:52 +12:00
defmodule AshDoubleEntry.Account do
2023-08-19 16:17:07 +12:00
@moduledoc """
An extension for creating a double entry ledger account. See the getting started guide for more.
"""
2023-07-22 12:27:52 +12:00
@account %Spark.Dsl.Section{
name: :account,
schema: [
open_action_accept: [
type: {:list, :atom},
doc: """
2023-09-27 02:46:30 +13:00
A list of extra attributes to be accepted by the open action. The `identifier` and `currency` attributes are always accepted.
""",
default: []
],
pre_check_identities_with: [
type: {:spark, Ash.Api},
doc: "An api to use to precheck generated identities. Required by certain data layers."
],
transfer_resource: [
type: {:spark, Ash.Resource},
doc: "The resource used for transfers",
required: true
],
balance_resource: [
type: {:spark, Ash.Resource},
doc: "The resource used for balances",
required: true
]
]
2023-07-22 12:27:52 +12:00
}
@sections [@account]
@transformers [
AshDoubleEntry.Account.Transformers.AddStructure
]
use Spark.Dsl.Extension,
sections: @sections,
transformers: @transformers
end