Update Author resource and test for the form.

This commit is contained in:
2025-04-15 10:09:20 +03:00
parent d004affd74
commit 8dc4a80e31
2 changed files with 48 additions and 10 deletions
@@ -31,8 +31,8 @@ defmodule DecentralisedBookIndex.Metadata.Author do
registry_id = Ash.Changeset.get_attribute(changeset, :author_alias_registry_id)
if registry_id == nil do
{:ok, registry} =
DecentralisedBookIndex.Metadata.create_author_alias_registry(actor: actor)
registry =
DecentralisedBookIndex.Metadata.create_author_alias_registry!(actor: actor)
Ash.Changeset.force_change_attribute(changeset, :author_alias_registry_id, registry.id)
else
@@ -54,8 +54,8 @@ defmodule DecentralisedBookIndex.Metadata.Author do
if related_author_id == nil do
Ash.Changeset.add_error(changeset, :related_author_id, "Related author is empty")
else
{:ok, related_author} =
DecentralisedBookIndex.Metadata.get_author_by_id(related_author_id)
related_author =
DecentralisedBookIndex.Metadata.get_author_by_id!(related_author_id)
Ash.Changeset.force_change_attribute(
changeset,