2023-07-22 12:27:52 +12:00
|
|
|
defmodule AshDoubleEntry.Transfer do
|
|
|
|
@account %Spark.Dsl.Section{
|
|
|
|
name: :transfer,
|
|
|
|
schema: [
|
2023-08-06 16:27:33 +12:00
|
|
|
pre_check_identities_with: [
|
|
|
|
type: {:spark, Ash.Api},
|
|
|
|
doc: "An api to use to precheck generated identities. Required by certain data layers."
|
|
|
|
],
|
2023-07-22 12:27:52 +12:00
|
|
|
account_resource: [
|
|
|
|
type: Ash.OptionsHelpers.ash_resource(),
|
|
|
|
doc: "The resource to use for account balances",
|
|
|
|
required: true
|
2023-08-06 16:27:33 +12:00
|
|
|
],
|
|
|
|
balance_resource: [
|
|
|
|
type: {:spark, Ash.Resource},
|
|
|
|
doc: "The resource being used for balances"
|
2023-07-22 12:27:52 +12:00
|
|
|
]
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
@sections [@account]
|
|
|
|
|
|
|
|
@transformers [
|
|
|
|
AshDoubleEntry.Transfer.Transformers.AddStructure
|
|
|
|
]
|
|
|
|
|
|
|
|
use Spark.Dsl.Extension,
|
|
|
|
sections: @sections,
|
|
|
|
transformers: @transformers
|
|
|
|
end
|