mirror of
https://github.com/ash-project/ash_csv.git
synced 2024-09-20 13:22:48 +12:00
26 lines
534 B
Elixir
26 lines
534 B
Elixir
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
|
|
defaults([:create, :read, :update, :destroy])
|
|
end
|
|
|
|
attributes do
|
|
uuid_primary_key(:id)
|
|
attribute(:title, :string)
|
|
attribute(:score, :integer)
|
|
attribute(:public, :boolean)
|
|
end
|
|
|
|
relationships do
|
|
has_many(:comments, AshCsv.Test.Comment, destination_field: :post_id)
|
|
end
|
|
end
|