|
|
@ -2,11 +2,19 @@ defmodule DecentralisedBookIndex.Metadata do
|
|
|
|
use Ash.Domain,
|
|
|
|
use Ash.Domain,
|
|
|
|
otp_app: :decentralised_book_index
|
|
|
|
otp_app: :decentralised_book_index
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
alias DecentralisedBookIndex.Metadata
|
|
|
|
|
|
|
|
|
|
|
|
resources do
|
|
|
|
resources do
|
|
|
|
resource DecentralisedBookIndex.Metadata.Book do
|
|
|
|
resource DecentralisedBookIndex.Metadata.Book do
|
|
|
|
define :create_book,
|
|
|
|
define :create_book,
|
|
|
|
action: :create,
|
|
|
|
action: :create,
|
|
|
|
args: [:title, :isbn, :description, :author_roles, {:optional, :book_editions_registry_id}]
|
|
|
|
args: [
|
|
|
|
|
|
|
|
:title,
|
|
|
|
|
|
|
|
:isbn,
|
|
|
|
|
|
|
|
:description,
|
|
|
|
|
|
|
|
:author_roles,
|
|
|
|
|
|
|
|
{:optional, :book_editions_registry_id}
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
define :add_book_to_related_editions_registry,
|
|
|
|
define :add_book_to_related_editions_registry,
|
|
|
|
action: :add_book_to_related_editions_registry,
|
|
|
|
action: :add_book_to_related_editions_registry,
|
|
|
@ -31,6 +39,7 @@ defmodule DecentralisedBookIndex.Metadata do
|
|
|
|
define :list_authors, action: :read
|
|
|
|
define :list_authors, action: :read
|
|
|
|
define :get_author_by_id, args: [:id], action: :by_id
|
|
|
|
define :get_author_by_id, args: [:id], action: :by_id
|
|
|
|
define :get_author_alternative_names, args: [:author], action: :get_alternative_names
|
|
|
|
define :get_author_alternative_names, args: [:author], action: :get_alternative_names
|
|
|
|
|
|
|
|
define :search_author, action: :search, args: [:name]
|
|
|
|
define :update_author, action: :update
|
|
|
|
define :update_author, action: :update
|
|
|
|
define :destroy_author, action: :destroy
|
|
|
|
define :destroy_author, action: :destroy
|
|
|
|
end
|
|
|
|
end
|
|
|
|