Skip to content

Commit e4d95d7

Browse files
committed
Replace custom amount type with money amount type
1 parent fbb0dad commit e4d95d7

File tree

5 files changed

+9
-147
lines changed

5 files changed

+9
-147
lines changed

demo/config/config.exs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ config :spark,
2525
"Ash.Domain": [section_order: [:resources, :policies, :authorization, :domain, :execution]]
2626
]
2727

28+
config :money,
29+
default_currency: :EUR,
30+
separator: ".",
31+
delimiter: ",",
32+
symbol_on_right: true,
33+
symbol_space: true
34+
2835
config :demo,
2936
namespace: Demo,
3037
ecto_repos: [Demo.Repo],

demo/lib/demo/invoice.ex

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ defmodule Demo.Invoice do
88
schema "invoices" do
99
field :company, :string
1010

11-
field :amount, Backpex.Ecto.Amount.Type,
12-
currency: :EUR,
13-
opts: [separator: ".", delimiter: ",", symbol_on_right: true, symbol_space: true]
11+
field :amount, Money.Ecto.Amount.Type
1412

1513
timestamps()
1614
end

demo/lib/demo/product.ex

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ defmodule Demo.Product do
1515
field :manufacturer, :string
1616
field :images, {:array, :string}
1717

18-
field :price, Backpex.Ecto.Amount.Type,
19-
currency: :EUR,
20-
opts: [separator: ".", delimiter: ",", symbol_on_right: true, symbol_space: true]
18+
field :price, Money.Ecto.Amount.Type
2119

2220
has_many :suppliers, Supplier, on_replace: :delete, on_delete: :delete_all
2321
has_many :short_links, ShortLink, on_replace: :delete, on_delete: :delete_all, foreign_key: :product_id

lib/backpex/ecto/amount_type.ex

Lines changed: 0 additions & 61 deletions
This file was deleted.

test/ecto/amount_type_test.exs

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)