feat: add role relationship to User resource
Add belongs_to :role relationship to User resource and register Authorization domain in config.
This commit is contained in:
parent
4535551b8d
commit
90c32c2afd
2 changed files with 6 additions and 1 deletions
|
|
@ -49,7 +49,7 @@ config :spark,
|
||||||
config :mv,
|
config :mv,
|
||||||
ecto_repos: [Mv.Repo],
|
ecto_repos: [Mv.Repo],
|
||||||
generators: [timestamp_type: :utc_datetime],
|
generators: [timestamp_type: :utc_datetime],
|
||||||
ash_domains: [Mv.Membership, Mv.Accounts, Mv.MembershipFees]
|
ash_domains: [Mv.Membership, Mv.Accounts, Mv.MembershipFees, Mv.Authorization]
|
||||||
|
|
||||||
# Configures the endpoint
|
# Configures the endpoint
|
||||||
config :mv, MvWeb.Endpoint,
|
config :mv, MvWeb.Endpoint,
|
||||||
|
|
|
||||||
|
|
@ -357,6 +357,11 @@ defmodule Mv.Accounts.User do
|
||||||
# This automatically creates a `member_id` attribute in the User table
|
# This automatically creates a `member_id` attribute in the User table
|
||||||
# The relationship is optional (allow_nil? true by default)
|
# The relationship is optional (allow_nil? true by default)
|
||||||
belongs_to :member, Mv.Membership.Member
|
belongs_to :member, Mv.Membership.Member
|
||||||
|
|
||||||
|
# 1:1 relationship - User belongs to a Role
|
||||||
|
# This automatically creates a `role_id` attribute in the User table
|
||||||
|
# The relationship is optional (allow_nil? true by default)
|
||||||
|
belongs_to :role, Mv.Authorization.Role
|
||||||
end
|
end
|
||||||
|
|
||||||
identities do
|
identities do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue