feat(ash): added accounts, user for authentication

This commit is contained in:
carla 2025-05-30 12:20:47 +02:00 committed by carla
parent 80e7041146
commit f154eea055
5 changed files with 160 additions and 1 deletions

26
lib/accounts/user.ex Normal file
View file

@ -0,0 +1,26 @@
defmodule Mv.Accounts.User do
use Ash.Resource,
domain: Mv.Accounts,
data_layer: AshPostgres.DataLayer
postgres do
table("users")
repo(Mv.Repo)
end
attributes do
uuid_primary_key(:id)
attribute(:email, :string, allow_nil?: true, public?: true)
attribute(:password_hash, :string, sensitive?: true)
attribute(:oicd_id, :string)
end
actions do
defaults([:read, :destroy, :create, :update])
end
relationships do
belongs_to(:member, Mv.Membership.Member)
end
end