Update the AuthorTransformer to sync all attributes and relationships.
This commit is contained in:
@@ -8,15 +8,21 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.AuthorTransformerTest do
|
||||
json_body = %{
|
||||
"data" => %{
|
||||
"attributes" => %{
|
||||
"description" => "Something",
|
||||
"name" => "Author",
|
||||
"author_alias_registry_id" => "1320a6fe-b311-45ac-bbaa-39cf29c44624",
|
||||
"avatar_url" => "/images/avatar.png",
|
||||
"author_alias_registry_id" => "1320a6fe-b311-45ac-bbaa-39cf29c44624"
|
||||
"dbi_server_id" => "889a323e-d104-4b5d-b276-dad5a9b1da99",
|
||||
"description" => "Something",
|
||||
"inserted_at" => "2025-03-25T19:19:15.187456Z",
|
||||
"name" => "Author",
|
||||
"updated_at" => "2025-03-26T10:16:16.124581Z"
|
||||
},
|
||||
"id" => "889a323e-d104-4b5d-b276-dad5a9b1da9d",
|
||||
"links" => %{},
|
||||
"meta" => %{},
|
||||
"relationships" => %{},
|
||||
"relationships" => %{
|
||||
"author_alias_registry" => %{"links" => %{}, "meta" => %{}},
|
||||
"dbi_server" => %{"links" => %{}, "meta" => %{}}
|
||||
},
|
||||
"type" => "author"
|
||||
},
|
||||
"jsonapi" => %{"version" => "1.0"},
|
||||
@@ -34,22 +40,31 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.AuthorTransformerTest do
|
||||
name: "Author",
|
||||
description: "Something",
|
||||
avatar_url: "/images/avatar.png",
|
||||
author_alias_registry_id: "1320a6fe-b311-45ac-bbaa-39cf29c44624"
|
||||
author_alias_registry_id: "1320a6fe-b311-45ac-bbaa-39cf29c44624",
|
||||
dbi_server_id: "889a323e-d104-4b5d-b276-dad5a9b1da99",
|
||||
inserted_at: "2025-03-25T19:19:15.187456Z",
|
||||
updated_at: "2025-03-26T10:16:16.124581Z"
|
||||
} = author
|
||||
end
|
||||
|
||||
test "a json doesn't contains author information \"data\" attribute" do
|
||||
json_body = %{
|
||||
"attributes" => %{
|
||||
"description" => "Something",
|
||||
"name" => "Author",
|
||||
"author_alias_registry_id" => "1320a6fe-b311-45ac-bbaa-39cf29c44624",
|
||||
"avatar_url" => "/images/avatar.png",
|
||||
"author_alias_registry_id" => "1320a6fe-b311-45ac-bbaa-39cf29c44624"
|
||||
"dbi_server_id" => "889a323e-d104-4b5d-b276-dad5a9b1da99",
|
||||
"description" => "Something",
|
||||
"inserted_at" => "2025-03-25T19:19:15.187456Z",
|
||||
"name" => "Author",
|
||||
"updated_at" => "2025-03-26T10:16:16.124581Z"
|
||||
},
|
||||
"id" => "889a323e-d104-4b5d-b276-dad5a9b1da9d",
|
||||
"links" => %{},
|
||||
"meta" => %{},
|
||||
"relationships" => %{},
|
||||
"relationships" => %{
|
||||
"author_alias_registry" => %{"links" => %{}, "meta" => %{}},
|
||||
"dbi_server" => %{"links" => %{}, "meta" => %{}}
|
||||
},
|
||||
"type" => "author"
|
||||
}
|
||||
|
||||
@@ -60,7 +75,10 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.AuthorTransformerTest do
|
||||
name: "Author",
|
||||
description: "Something",
|
||||
avatar_url: "/images/avatar.png",
|
||||
author_alias_registry_id: "1320a6fe-b311-45ac-bbaa-39cf29c44624"
|
||||
author_alias_registry_id: "1320a6fe-b311-45ac-bbaa-39cf29c44624",
|
||||
dbi_server_id: "889a323e-d104-4b5d-b276-dad5a9b1da99",
|
||||
inserted_at: "2025-03-25T19:19:15.187456Z",
|
||||
updated_at: "2025-03-26T10:16:16.124581Z"
|
||||
} = author
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user