add type specs and fix id issues
Some checks failed
Build and Publish / build-release (push) Failing after 37s

This commit is contained in:
2026-04-21 12:55:38 -05:00
parent f857a5f900
commit 2bf99bfb37
7 changed files with 78 additions and 42 deletions

View File

@@ -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} ->