Update DBIServerTransformer to fetch the dbi_server relationship.
This commit is contained in:
@@ -13,7 +13,9 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.DBIServerTransformer do
|
|||||||
name: get_in(json_body, ["attributes", "name"]),
|
name: get_in(json_body, ["attributes", "name"]),
|
||||||
url: get_in(json_body, ["attributes", "url"]),
|
url: get_in(json_body, ["attributes", "url"]),
|
||||||
inserted_at: get_in(json_body, ["attributes", "inserted_at"]),
|
inserted_at: get_in(json_body, ["attributes", "inserted_at"]),
|
||||||
updated_at: get_in(json_body, ["attributes", "updated_at"])
|
updated_at: get_in(json_body, ["attributes", "updated_at"]),
|
||||||
|
# relationship
|
||||||
|
dbi_server_id: get_in(json_body, ["attributes", "dbi_server_id"])
|
||||||
}
|
}
|
||||||
|
|
||||||
{:ok, attrs}
|
{:ok, attrs}
|
||||||
|
|||||||
+4
-2
@@ -8,6 +8,7 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.DBIServerTransformerTest
|
|||||||
json_body = %{
|
json_body = %{
|
||||||
"data" => %{
|
"data" => %{
|
||||||
"attributes" => %{
|
"attributes" => %{
|
||||||
|
"dbi_server_id" => "0c0647ec-07ef-4caa-b683-5847dbfbe5cc",
|
||||||
"inserted_at" => "2025-03-22T20:07:30.766249Z",
|
"inserted_at" => "2025-03-22T20:07:30.766249Z",
|
||||||
"name" => "Test",
|
"name" => "Test",
|
||||||
"updated_at" => "2025-05-04T18:48:44.213309Z",
|
"updated_at" => "2025-05-04T18:48:44.213309Z",
|
||||||
@@ -16,7 +17,7 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.DBIServerTransformerTest
|
|||||||
"id" => "0c0647ec-07ef-4caa-b683-5847dbfbe5cc",
|
"id" => "0c0647ec-07ef-4caa-b683-5847dbfbe5cc",
|
||||||
"links" => %{},
|
"links" => %{},
|
||||||
"meta" => %{},
|
"meta" => %{},
|
||||||
"relationships" => %{},
|
"relationships" => %{"dbi_server" => %{"links" => %{}, "meta" => %{}}},
|
||||||
"type" => "dbi_server"
|
"type" => "dbi_server"
|
||||||
},
|
},
|
||||||
"jsonapi" => %{"version" => "1.0"},
|
"jsonapi" => %{"version" => "1.0"},
|
||||||
@@ -34,7 +35,8 @@ defmodule DecentralisedBookIndex.Sync.DataTransformers.DBIServerTransformerTest
|
|||||||
name: "Test",
|
name: "Test",
|
||||||
url: "http://localhost:4001",
|
url: "http://localhost:4001",
|
||||||
inserted_at: "2025-03-22T20:07:30.766249Z",
|
inserted_at: "2025-03-22T20:07:30.766249Z",
|
||||||
updated_at: "2025-05-04T18:48:44.213309Z"
|
updated_at: "2025-05-04T18:48:44.213309Z",
|
||||||
|
dbi_server_id: "0c0647ec-07ef-4caa-b683-5847dbfbe5cc"
|
||||||
} = server
|
} = server
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user