Update the AuthorTransformer to return a map instead of a struct.
This commit is contained in:
@@ -3,7 +3,7 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.AuthorTransformer do
|
||||
alias DecentralisedBookIndex.Metadata.Author
|
||||
|
||||
def from_json(json_body) do
|
||||
author = %Author{
|
||||
author = %{
|
||||
id: get_in(json_body, ["data", "id"]),
|
||||
name: get_in(json_body, ["data", "attributes", "name"]),
|
||||
description: get_in(json_body, ["data", "attributes", "description"]),
|
||||
|
||||
@@ -23,7 +23,7 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.AuthorTransformerTest do
|
||||
}
|
||||
|
||||
assert {:ok, author} = AuthorTransformer.from_json(json_body)
|
||||
assert %Author{
|
||||
assert %{
|
||||
id: "889a323e-d104-4b5d-b276-dad5a9b1da9d",
|
||||
name: "Author",
|
||||
description: "Something"
|
||||
|
||||
Reference in New Issue
Block a user