Skip to content

Commit

Permalink
Address coments
Browse files Browse the repository at this point in the history
  • Loading branch information
EMaksy committed Oct 1, 2024
1 parent 4ac73d8 commit 75cec53
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
6 changes: 3 additions & 3 deletions lib/wanda_web/controllers/fallback_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ defmodule WandaWeb.FallbackController do
def call(conn, {:error, :no_checks_selected}) do
conn
|> put_status(:unprocessable_entity)
|> put_view(ErrorJSON)
|> put_view(json: ErrorJSON)
|> render(:"422", reason: "No checks were selected.")
end

def call(conn, {:error, :already_running}) do
conn
|> put_status(:unprocessable_entity)
|> put_view(ErrorJSON)
|> put_view(json: ErrorJSON)
|> render(:"422", reason: "Execution already running.")
end

def call(conn, _) do
conn
|> put_status(:internal_server_error)
|> put_view(ErrorJSON)
|> put_view(json: ErrorJSON)
|> render(:"500")
end
end
2 changes: 1 addition & 1 deletion lib/wanda_web/controllers/health_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ defmodule WandaWeb.HealthController do

conn
|> put_status(if db_status == :pass, do: 200, else: 500)
|> render("health.json", health: %{database: db_status})
|> render(:health, health: %{database: db_status})
end
end
3 changes: 1 addition & 2 deletions lib/wanda_web/views/v1/execution_json.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
defmodule WandaWeb.V1.ExecutionJSON do
alias Wanda.Executions.Execution
alias WandaWeb.V1.ExecutionJSON

def index(%{executions: executions, total_count: total_count}) do
%{
Expand All @@ -16,7 +15,7 @@ defmodule WandaWeb.V1.ExecutionJSON do
end

def show(%{execution: execution}) do
ExecutionJSON.execution(execution)
execution(execution)
end

def start(%{
Expand Down
2 changes: 1 addition & 1 deletion lib/wanda_web/views/v2/catalog_json.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ defmodule WandaWeb.V2.CatalogJSON do
alias WandaWeb.V1.CatalogJSON

def catalog(%{catalog: catalog}) do
%{items: Enum.map(catalog, fn check -> CatalogJSON.check(check) end)}
%{items: Enum.map(catalog, &CatalogJSON.check/1)}
end
end
4 changes: 1 addition & 3 deletions lib/wanda_web/views/v2/execution_json.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
defmodule WandaWeb.V2.ExecutionJSON do
alias WandaWeb.V2.ExecutionJSON

alias Wanda.Executions.Execution

def index(%{executions: executions, total_count: total_count}) do
Expand All @@ -11,7 +9,7 @@ defmodule WandaWeb.V2.ExecutionJSON do
end

def show(%{execution: execution}) do
ExecutionJSON.execution(execution)
execution(execution)
end

def execution(%Execution{
Expand Down

0 comments on commit 75cec53

Please sign in to comment.