James Harton
01c9e73b5b
All checks were successful
continuous-integration/drone/push Build is passing
This makes the design a little easier to understand and change. Also implements building of many params/records as a side-effect. Reviewed-on: https://code.harton.nz/james/smokestack/pulls/6 Co-authored-by: James Harton <james@harton.nz> Co-committed-by: James Harton <james@harton.nz>
32 lines
491 B
Elixir
32 lines
491 B
Elixir
defmodule Support.Author do
|
|
@moduledoc false
|
|
|
|
use Ash.Resource,
|
|
data_layer: Ash.DataLayer.Ets,
|
|
validate_api_inclusion?: false
|
|
|
|
ets do
|
|
private? true
|
|
end
|
|
|
|
attributes do
|
|
uuid_primary_key :id
|
|
|
|
attribute :name, :string
|
|
attribute :email, :ci_string
|
|
|
|
timestamps()
|
|
end
|
|
|
|
relationships do
|
|
has_many :posts, Support.Post
|
|
end
|
|
|
|
actions do
|
|
defaults [:create, :read, :update, :destroy]
|
|
end
|
|
|
|
aggregates do
|
|
count :count_of_posts, :posts
|
|
end
|
|
end
|