add type specs and fix id issues
Some checks failed
Build and Publish / build-release (push) Failing after 37s
Some checks failed
Build and Publish / build-release (push) Failing after 37s
This commit is contained in:
@@ -4,6 +4,7 @@ defmodule WorkloadServiceWeb.TaskController do
|
||||
|
||||
alias WorkloadService.CommandedApp
|
||||
alias WorkloadService.Workload.Queries
|
||||
alias WorkloadService.Aggregates.TaskId
|
||||
alias WorkloadServiceWeb.Schemas.Task, as: S
|
||||
|
||||
tags(["Tasks"])
|
||||
@@ -93,8 +94,9 @@ defmodule WorkloadServiceWeb.TaskController do
|
||||
conn |> put_status(:not_found) |> json(%{error: "task not found"})
|
||||
|
||||
{:ok, %{status: "created"} = _task} ->
|
||||
task_id = TaskId.parse!(id)
|
||||
command = %WorkloadService.Commands.QuoteTask.SubmitResponse{
|
||||
id: id,
|
||||
id: task_id,
|
||||
submission: %{
|
||||
"quote_id" => params["quote_id"],
|
||||
"plans" => params["plans"],
|
||||
@@ -118,8 +120,9 @@ defmodule WorkloadServiceWeb.TaskController do
|
||||
conn |> put_status(:not_found) |> json(%{error: "task not found"})
|
||||
|
||||
{:ok, %{status: "created"} = _task} ->
|
||||
task_id = TaskId.parse!(id)
|
||||
command = %WorkloadService.Commands.SolicitationTask.SubmitResponse{
|
||||
id: id,
|
||||
id: task_id,
|
||||
submission: %{
|
||||
"recorded_by" => params["recorded_by"] || "system"
|
||||
},
|
||||
@@ -166,7 +169,8 @@ defmodule WorkloadServiceWeb.TaskController do
|
||||
conn |> put_status(:not_found) |> json(%{error: "task not found"})
|
||||
|
||||
{:ok, %{status: "draft"} = _task} ->
|
||||
command = struct(command_module, id: id)
|
||||
task_id = TaskId.parse!(id)
|
||||
command = struct(command_module, id: task_id)
|
||||
dispatch_and_respond(conn, id, command)
|
||||
|
||||
{:ok, _task} ->
|
||||
@@ -214,7 +218,8 @@ defmodule WorkloadServiceWeb.TaskController do
|
||||
conn |> put_status(:not_found) |> json(%{error: "task not found"})
|
||||
|
||||
{:ok, %{status: "approved"} = _task} ->
|
||||
command = struct(command_module, id: id, completed_by: completed_by)
|
||||
task_id = TaskId.parse!(id)
|
||||
command = struct(command_module, id: task_id, completed_by: completed_by)
|
||||
dispatch_and_respond(conn, id, command)
|
||||
|
||||
{:ok, _task} ->
|
||||
|
||||
Reference in New Issue
Block a user