You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.9 KiB
82 lines
2.9 KiB
defmodule DecentralisedBookIndex.Metadata do
|
|
use Ash.Domain, otp_app: :decentralised_book_index, extensions: [AshJsonApi.Domain, AshPhoenix]
|
|
|
|
alias DecentralisedBookIndex.Metadata
|
|
|
|
resources do
|
|
resource DecentralisedBookIndex.Metadata.Book do
|
|
define :create_book,
|
|
action: :create,
|
|
args: [
|
|
:title,
|
|
:isbn,
|
|
:description,
|
|
:author_roles,
|
|
{:optional, :book_editions_registry_id}
|
|
]
|
|
|
|
define :add_book_to_related_editions_registry,
|
|
action: :add_book_to_related_editions_registry,
|
|
args: [:title, :isbn, :description, :author_roles, :related_book_id]
|
|
|
|
define :list_books, action: :read
|
|
define :get_book_by_id, args: [:id], action: :by_id
|
|
define :get_book_alternative_editions, args: [:book], action: :get_alternative_editions
|
|
define :update_book, action: :update
|
|
define :destroy_book, action: :destroy
|
|
end
|
|
|
|
resource DecentralisedBookIndex.Metadata.Author do
|
|
define :create_author,
|
|
action: :create,
|
|
args: [:name, :description, {:optional, :author_alias_registry_id}]
|
|
|
|
define :add_author_to_related_alias_registry,
|
|
action: :add_author_to_related_alias_registry,
|
|
args: [:name, :description, :related_author_id]
|
|
|
|
define :list_authors, action: :read
|
|
define :get_author_by_id, args: [:id], action: :by_id
|
|
define :get_author_alternative_names, args: [:author], action: :get_alternative_names
|
|
define :search_author, action: :search, args: [:name]
|
|
define :update_author, action: :update
|
|
define :destroy_author, action: :destroy
|
|
end
|
|
|
|
resource DecentralisedBookIndex.Metadata.DBIServer
|
|
|
|
resource DecentralisedBookIndex.Metadata.AuthorAliasRegistry do
|
|
define :create_author_alias_registry, action: :create
|
|
define :list_author_alias_registries, action: :read
|
|
define :get_author_alias_registry_by_id, args: [:id], action: :by_id
|
|
define :update_author_alias_registry, action: :update
|
|
define :destroy_author_alias_registry, action: :destroy
|
|
end
|
|
|
|
resource DecentralisedBookIndex.Metadata.BookEditionsRegistry do
|
|
define :create_book_editions_registry, action: :create
|
|
define :list_book_editions_registries, action: :read
|
|
define :get_book_editions_registry_by_id, args: [:id], action: :by_id
|
|
define :update_book_editions_registry, action: :update
|
|
define :destroy_book_editions_registry, action: :destroy
|
|
end
|
|
|
|
resource DecentralisedBookIndex.Metadata.AuthorRole do
|
|
define :create_author_role, action: :create, args: [:author_id, :order, :role]
|
|
define :list_author_roles, action: :read
|
|
define :get_author_role_by_id, args: [:id], action: :by_id
|
|
define :update_author_role, action: :update
|
|
define :destroy_author_role, action: :destroy
|
|
end
|
|
end
|
|
|
|
json_api do
|
|
routes do
|
|
base_route "/author", Metadata.Author do
|
|
get :read
|
|
index :search
|
|
end
|
|
end
|
|
end
|
|
end
|