smokestack/test/support/author.ex

35 lines
563 B
Elixir
Raw Normal View History

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
aggregates do
count :count_of_posts, :posts
end
2023-08-10 21:01:45 +12:00
end