2023-08-10 21:01:45 +12:00
|
|
|
defmodule Support.Author do
|
|
|
|
@moduledoc false
|
|
|
|
|
|
|
|
use Ash.Resource,
|
|
|
|
data_layer: Ash.DataLayer.Ets,
|
2024-03-28 10:04:54 +13:00
|
|
|
validate_domain_inclusion?: false,
|
|
|
|
domain: nil
|
2023-08-10 21:01:45 +12:00
|
|
|
|
|
|
|
ets do
|
|
|
|
private? true
|
|
|
|
end
|
|
|
|
|
|
|
|
attributes do
|
|
|
|
uuid_primary_key :id
|
|
|
|
|
2024-03-28 10:04:54 +13:00
|
|
|
attribute :name, :string, public?: true
|
|
|
|
attribute :email, :ci_string, public?: true
|
2023-08-10 21:01:45 +12:00
|
|
|
|
|
|
|
timestamps()
|
|
|
|
end
|
|
|
|
|
|
|
|
relationships do
|
|
|
|
has_many :posts, Support.Post
|
|
|
|
end
|
|
|
|
|
|
|
|
actions do
|
|
|
|
defaults [:create, :read, :update, :destroy]
|
2024-03-28 10:04:54 +13:00
|
|
|
default_accept :*
|
2023-08-10 21:01:45 +12:00
|
|
|
end
|
2023-09-08 07:25:39 +12:00
|
|
|
|
|
|
|
aggregates do
|
|
|
|
count :count_of_posts, :posts
|
|
|
|
end
|
2023-08-10 21:01:45 +12:00
|
|
|
end
|