Update to allow a Book to have no Publisher.

This commit is contained in:
2025-06-03 18:06:26 +03:00
parent cedc4d78e8
commit 30df53702b
4 changed files with 256 additions and 7 deletions
@@ -373,7 +373,6 @@ defmodule DecentralisedBookIndex.Metadata.Book do
end
belongs_to :publisher, Metadata.Publisher do
allow_nil? false
public? true
end
@@ -64,12 +64,14 @@ defmodule DecentralisedBookIndexWeb.BookLive.Show do
<dt class="mb-2 font-semibold leading-none text-gray-900 dark:text-white">Description</dt>
<dd class="mb-4 font-light text-gray-500 sm:mb-5 dark:text-gray-400">{@book.description}</dd>
</dl>
<dl>
<dt class="mb-2 font-semibold leading-none text-gray-900 dark:text-white">Publisher</dt>
<dd class="mb-4 font-light text-gray-500 sm:mb-5 dark:text-gray-400">
{@book.publisher.name}
</dd>
</dl>
<%= if not is_nil(@book.publisher) do %>
<dl>
<dt class="mb-2 font-semibold leading-none text-gray-900 dark:text-white">Publisher</dt>
<dd class="mb-4 font-light text-gray-500 sm:mb-5 dark:text-gray-400">
{@book.publisher.name}
</dd>
</dl>
<% end %>
<dl>
<dt class="mb-2 font-semibold leading-none text-gray-900 dark:text-white">Published</dt>
<dd class="mb-4 font-light text-gray-500 sm:mb-5 dark:text-gray-400">{@book.published}</dd>