fix: add test coverage for api

This commit is contained in:
guarzo
2025-07-12 22:28:59 +00:00
parent 63f13711cc
commit 7b9e2c4fd9
61 changed files with 5657 additions and 5693 deletions

View File

@@ -246,10 +246,17 @@ defmodule WandererAppWeb.MapConnectionAPIController do
}) do
with {:ok, source} <- APIUtils.parse_int(src),
{:ok, target} <- APIUtils.parse_int(tgt),
{:ok, conn_struct} <- Operations.get_connection_by_systems(map_id, source, target) do
{:ok, conn_struct} when not is_nil(conn_struct) <-
Operations.get_connection_by_systems(map_id, source, target) do
APIUtils.respond_data(conn, APIUtils.connection_to_json(conn_struct))
else
err -> err
{:ok, nil} ->
conn
|> put_status(:not_found)
|> json(%{error: "Connection not found"})
err ->
err
end
end