parent
f7faa15837
commit
08e1c843cc
@ -0,0 +1,8 @@
|
|||||||
|
defmodule DecentralisedBookIndex.Books do
|
||||||
|
use Ash.Domain,
|
||||||
|
otp_app: :decentralised_book_index
|
||||||
|
|
||||||
|
resources do
|
||||||
|
resource DecentralisedBookIndex.Books.Book
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,30 @@
|
|||||||
|
defmodule DecentralisedBookIndex.Books.Book do
|
||||||
|
use Ash.Resource,
|
||||||
|
otp_app: :decentralised_book_index,
|
||||||
|
domain: DecentralisedBookIndex.Books
|
||||||
|
|
||||||
|
actions do
|
||||||
|
defaults [:read]
|
||||||
|
end
|
||||||
|
|
||||||
|
attributes do
|
||||||
|
uuid_primary_key :id
|
||||||
|
|
||||||
|
attribute :title, :string do
|
||||||
|
allow_nil? false
|
||||||
|
public? true
|
||||||
|
end
|
||||||
|
|
||||||
|
attribute :isbn, :string do
|
||||||
|
allow_nil? false
|
||||||
|
public? true
|
||||||
|
end
|
||||||
|
|
||||||
|
attribute :description, :string do
|
||||||
|
allow_nil? false
|
||||||
|
public? true
|
||||||
|
end
|
||||||
|
|
||||||
|
timestamps()
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in new issue