Add the attribute for a cover image url for Book.

This commit is contained in:
2025-03-16 08:42:25 +02:00
parent ddc5cc590f
commit 100d8ba39a
5 changed files with 223 additions and 4 deletions
+1
View File
@@ -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