ash_double_entry/lib/account/transformers/add_structure.ex
Zach Daniel 25b3dc3063 init
2023-07-21 20:27:52 -04:00

17 lines
385 B
Elixir

defmodule AshDoubleEntry.Account.Transformers.AddStructure do
use Spark.Dsl.Transformer
def transform(dsl) do
dsl
|> Ash.Resource.Builder.add_attribute(:balance, :decimal,
allow_nil?: false,
default: Decimal.new(0),
writable?: false
)
|> Ash.Resource.Builder.add_attribute(
:currency,
:string,
allow_nil?: false
)
end
end