dev
KKlochko 4 months ago
parent f7faa15837
commit 08e1c843cc

@ -53,7 +53,7 @@ config :spark,
config :decentralised_book_index, config :decentralised_book_index,
ecto_repos: [DecentralisedBookIndex.Repo], ecto_repos: [DecentralisedBookIndex.Repo],
generators: [timestamp_type: :utc_datetime], generators: [timestamp_type: :utc_datetime],
ash_domains: [DecentralisedBookIndex.Accounts] ash_domains: [DecentralisedBookIndex.Books, DecentralisedBookIndex.Accounts]
# Configures the endpoint # Configures the endpoint
config :decentralised_book_index, DecentralisedBookIndexWeb.Endpoint, config :decentralised_book_index, DecentralisedBookIndexWeb.Endpoint,

@ -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…
Cancel
Save