feat(ash): added accounts, user for authentication
This commit is contained in:
parent
80e7041146
commit
f154eea055
5 changed files with 160 additions and 1 deletions
26
lib/accounts/user.ex
Normal file
26
lib/accounts/user.ex
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue