Add the attribute for a cover image url for Book.
This commit is contained in:
@@ -39,6 +39,7 @@ defmodule DecentralisedBookIndex.Metadata do
|
||||
define :get_book_alternative_editions, args: [:book], action: :get_alternative_editions
|
||||
define :get_author_books, args: [:author], action: :get_author_books
|
||||
define :update_book, action: :update
|
||||
define :assign_book_cover_image, args: [:cover_image_url], action: :assign_cover_image
|
||||
define :destroy_book, action: :destroy
|
||||
end
|
||||
|
||||
|
||||
@@ -100,6 +100,10 @@ defmodule DecentralisedBookIndex.Metadata.Book do
|
||||
|> Ash.Query.filter(expr(exists(author_roles, author_id in ^author_ids)))
|
||||
end
|
||||
end
|
||||
|
||||
update :assign_cover_image do
|
||||
accept [:cover_image_url]
|
||||
end
|
||||
end
|
||||
|
||||
attributes do
|
||||
@@ -135,6 +139,11 @@ defmodule DecentralisedBookIndex.Metadata.Book do
|
||||
public? true
|
||||
end
|
||||
|
||||
attribute :cover_image_url, :string do
|
||||
allow_nil? true
|
||||
public? true
|
||||
end
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user