ash_csv/test/support/resources/post.ex

30 lines
562 B
Elixir
Raw Normal View History

2020-10-06 18:36:35 +13:00
defmodule AshCsv.Test.Post do
@moduledoc false
use Ash.Resource,
data_layer: AshCsv.DataLayer
csv do
create? true
columns [:id, :title, :score, :public]
file "test/data_files/posts.csv"
end
actions do
read(:read)
update(:update)
create(:create)
destroy(:destroy)
end
attributes do
2021-01-22 19:07:24 +13:00
uuid_primary_key(:id)
2020-10-06 18:36:35 +13:00
attribute(:title, :string)
attribute(:score, :integer)
attribute(:public, :boolean)
end
relationships do
has_many(:comments, AshCsv.Test.Comment, destination_field: :post_id)
end
end