ash_cubdb/test/support/post.ex

36 lines
587 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
2023-10-02 15:36:56 +13:00
defaults ~w[create read update destroy]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-10-02 15:36:56 +13:00
define :destroy
2023-08-07 17:47:06 +12:00
end
end