mirror of
https://github.com/wanderer-industries/wanderer
synced 2025-12-12 18:56:01 +00:00
fix: add test coverage for api
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user