Files
wanderer/lib/wanderer_app/api/user_transaction.ex
Dmitry Popov 083e300ff5
Some checks failed
Build Test / 🚀 Deploy to test env (fly.io) (push) Has been cancelled
Build Test / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
Build Develop / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
🧪 Test Suite / Test Suite (push) Has been cancelled
Build Develop / 🛠 Build Docker Images (linux/amd64) (push) Has been cancelled
Build Develop / 🛠 Build Docker Images (linux/arm64) (push) Has been cancelled
Build Develop / merge (push) Has been cancelled
Build Develop / 🏷 Notify about develop release (push) Has been cancelled
chore: updated deps, fixed signatures and comments related issues
2025-11-21 14:23:44 +01:00

67 lines
1.1 KiB
Elixir

defmodule WandererApp.Api.UserTransaction do
@moduledoc false
use Ash.Resource,
domain: WandererApp.Api,
data_layer: AshPostgres.DataLayer
postgres do
repo(WandererApp.Repo)
table("user_transaction_v1")
end
code_interface do
define(:new, action: :new)
end
actions do
default_accept [
:journal_ref_id,
:user_id,
:date,
:amount,
:corporation_id
]
defaults [:read]
create :new do
accept [:journal_ref_id, :user_id, :date, :amount, :corporation_id]
primary?(true)
end
end
attributes do
uuid_primary_key :id
attribute :journal_ref_id, :integer do
allow_nil? false
end
attribute :corporation_id, :integer do
allow_nil? false
end
attribute :amount, :float do
allow_nil? false
end
attribute :date, :utc_datetime do
allow_nil? true
end
attribute :reason, :string
create_timestamp(:inserted_at)
update_timestamp(:updated_at)
end
relationships do
belongs_to :user, WandererApp.Api.User do
primary_key? true
allow_nil? false
attribute_writable? true
end
end
end