Add descriptions for resources' actions.

dev
KKlochko 3 months ago
parent db025ece6a
commit b7979bf6ba

@ -25,6 +25,10 @@ defmodule DecentralisedBookIndex.Metadata.Author do
end end
end end
resource do
description "An author's metadata."
end
actions do actions do
defaults [:read, :destroy] defaults [:read, :destroy]
@ -100,6 +104,7 @@ defmodule DecentralisedBookIndex.Metadata.Author do
end end
read :by_id do read :by_id do
description "Return the Author by its id."
argument :id, :uuid, allow_nil?: false argument :id, :uuid, allow_nil?: false
get? true get? true
filter expr(id == ^arg(:id)) filter expr(id == ^arg(:id))
@ -136,7 +141,10 @@ defmodule DecentralisedBookIndex.Metadata.Author do
end end
read :search do read :search do
description "Return a list of Authors, optionally filtering by name."
argument :name, :ci_string do argument :name, :ci_string do
description "Return Authors, which names includes the name."
constraints allow_empty?: true constraints allow_empty?: true
default "" default ""
end end

@ -21,8 +21,12 @@ defmodule DecentralisedBookIndex.Metadata.AuthorRole do
end end
end end
resource do
description "A metadata of an author's role."
end
actions do actions do
defaults [:read, :destroy] defaults [:destroy]
create :create do create :create do
primary? true primary? true
@ -43,13 +47,20 @@ defmodule DecentralisedBookIndex.Metadata.AuthorRole do
end end
end end
read :read do
description "Return a list of AuthorRoles."
primary? true
end
read :by_id do read :by_id do
description "Return the AuthorRole by its id."
argument :id, :uuid, allow_nil?: false argument :id, :uuid, allow_nil?: false
get? true get? true
filter expr(id == ^arg(:id)) filter expr(id == ^arg(:id))
end end
read :by_book_id do read :by_book_id do
description "Return the AuthorRole by its BookId."
argument :book_id, :uuid, allow_nil?: false argument :book_id, :uuid, allow_nil?: false
filter expr(book_id == ^arg(:book_id)) filter expr(book_id == ^arg(:book_id))
end end

@ -25,6 +25,10 @@ defmodule DecentralisedBookIndex.Metadata.Book do
end end
end end
resource do
description "A book's metadata."
end
actions do actions do
defaults [:read, :destroy] defaults [:read, :destroy]
@ -142,6 +146,7 @@ defmodule DecentralisedBookIndex.Metadata.Book do
end end
read :by_id do read :by_id do
description "Return the Book by its id."
argument :id, :uuid, allow_nil?: false argument :id, :uuid, allow_nil?: false
get? true get? true
filter expr(id == ^arg(:id)) filter expr(id == ^arg(:id))
@ -182,7 +187,10 @@ defmodule DecentralisedBookIndex.Metadata.Book do
end end
read :search do read :search do
description "Return a list of Books, optionally filtering by title."
argument :query, :ci_string do argument :query, :ci_string do
description "Return Books, which titles includes the query."
constraints allow_empty?: true constraints allow_empty?: true
default "" default ""
end end
@ -193,6 +201,8 @@ defmodule DecentralisedBookIndex.Metadata.Book do
end end
read :search_by_bid do read :search_by_bid do
description "Return a list of Books, optionally filtering by BookId."
argument :type, :string, allow_nil?: false argument :type, :string, allow_nil?: false
argument :bid, :string, allow_nil?: false argument :bid, :string, allow_nil?: false

@ -26,8 +26,12 @@ defmodule DecentralisedBookIndex.Metadata.BookId do
end end
end end
resource do
description "A book's identifier."
end
actions do actions do
defaults [:read, :destroy] defaults [:destroy]
create :create do create :create do
primary? true primary? true
@ -39,7 +43,13 @@ defmodule DecentralisedBookIndex.Metadata.BookId do
accept [:id, :type, :bid, :order] accept [:id, :type, :bid, :order]
end end
read :read do
description "Return a list of BookIds."
primary? true
end
read :by_id do read :by_id do
description "Return the BookId by its id."
argument :id, :uuid, allow_nil?: false argument :id, :uuid, allow_nil?: false
get? true get? true
filter expr(id == ^arg(:id)) filter expr(id == ^arg(:id))

@ -21,6 +21,10 @@ defmodule DecentralisedBookIndex.Metadata.DBIServer do
end end
end end
resource do
description "An DBIServer's metadata."
end
actions do actions do
defaults [:read, :destroy] defaults [:read, :destroy]
@ -43,13 +47,17 @@ defmodule DecentralisedBookIndex.Metadata.DBIServer do
end end
read :by_id do read :by_id do
description "Return the DBIServer by its id."
argument :id, :uuid, allow_nil?: false argument :id, :uuid, allow_nil?: false
get? true get? true
filter expr(id == ^arg(:id)) filter expr(id == ^arg(:id))
end end
read :search do read :search do
description "Return a list of DBIServers, optionally filtering by name."
argument :name, :ci_string do argument :name, :ci_string do
description "Return DBIServers, which names includes the name."
constraints allow_empty?: true constraints allow_empty?: true
default "" default ""
end end

@ -22,8 +22,12 @@ defmodule DecentralisedBookIndex.Metadata.Publisher do
end end
end end
resource do
description "An publisher's metadata."
end
actions do actions do
defaults [:read, :destroy] defaults [:destroy]
create :create do create :create do
primary? true primary? true
@ -34,14 +38,23 @@ defmodule DecentralisedBookIndex.Metadata.Publisher do
accept [:id, :name, :inserted_at, :updated_at, :dbi_server_id] accept [:id, :name, :inserted_at, :updated_at, :dbi_server_id]
end end
read :read do
description "Return a list of Publishers."
primary? true
end
read :by_id do read :by_id do
description "Return the Publisher by its id."
argument :id, :uuid, allow_nil?: false argument :id, :uuid, allow_nil?: false
get? true get? true
filter expr(id == ^arg(:id)) filter expr(id == ^arg(:id))
end end
read :search do read :search do
description "Return a list of Publishers, optionally filtering by name."
argument :name, :ci_string do argument :name, :ci_string do
description "Return Publishers, which names includes the name."
constraints allow_empty?: true constraints allow_empty?: true
default "" default ""
end end

Loading…
Cancel
Save