ash_cubdb/test/support/post.ex

36 lines
606 B
Elixir
Raw Normal View History

2023-08-07 17:47:06 +12:00
defmodule Support.Post do
@moduledoc false
use Ash.Resource, data_layer: AshCubDB.DataLayer
cubdb do
otp_app :ash_cubdb
end
attributes do
uuid_primary_key :id do
writable? true
2023-08-07 17:47:06 +12:00
end
attribute :title, :string
attribute :body, :string
2023-08-07 17:47:06 +12:00
end
actions do
# defaults ~w[create read update destroy]a
defaults ~w[create read update]a
2023-08-07 17:47:06 +12:00
end
relationships do
belongs_to :author, Support.Author
2023-08-07 17:47:06 +12:00
end
code_interface do
define_for Support.Api
2023-08-07 17:47:06 +12:00
define :create
define :read
define :update
define :get, action: :read, get_by: [:id]
2023-08-07 17:47:06 +12:00
end
end