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
+1 -1
View File
@@ -53,7 +53,7 @@ config :spark,
config :decentralised_book_index,
ecto_repos: [DecentralisedBookIndex.Repo],
generators: [timestamp_type: :utc_datetime],
ash_domains: [DecentralisedBookIndex.Accounts]
ash_domains: [DecentralisedBookIndex.Books, DecentralisedBookIndex.Accounts]
# Configures the endpoint
config :decentralised_book_index, DecentralisedBookIndexWeb.Endpoint,
+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