Add books.

This commit is contained in:
2025-03-04 21:54:54 +02:00
parent f7faa15837
commit 08e1c843cc
3 changed files with 39 additions and 1 deletions
+8
View File
@@ -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