revamp aggregate and use typestruct
All checks were successful
Build and Publish / build-release (push) Successful in 1m41s

This commit is contained in:
2026-04-22 11:37:04 -05:00
parent 5f2f9e9085
commit a7160aadcf
19 changed files with 228 additions and 185 deletions

View File

@@ -155,9 +155,8 @@ defmodule PolicyServiceWeb.PolicyController do
"car" ->
%CarPolicy.AcceptQuoteAndSolicit{
id: PolicyId.new(org_id, policy.policy_type, application_id),
quote_id: params["quote_id"],
plan_id: params["plan_id"],
solicitation_fields: params["solicitation_fields"] || %{}
accepted_by: params["accepted_by"] || "system",
accepted_plan_id: params["accepted_plan_id"]
}
end
@@ -166,9 +165,6 @@ defmodule PolicyServiceWeb.PolicyController do
{:ok, updated} = PolicyQueries.get_by_application_id(org_id, application_id)
conn |> put_status(:ok) |> json(%{data: policy_detail(updated)})
{:error, :quote_not_found} ->
conn |> put_status(:not_found) |> json(%{error: "quote not found"})
{:error, :plan_not_found} ->
conn |> put_status(:not_found) |> json(%{error: "plan not found"})
@@ -192,7 +188,7 @@ defmodule PolicyServiceWeb.PolicyController do
status: p.status,
applicant_info: p.applicant_info,
policy_details: p.policy_details,
policy_number: p.policy_number,
provider_policy_number: p.provider_policy_number,
submitted_at: p.submitted_at
}
end
@@ -208,13 +204,9 @@ defmodule PolicyServiceWeb.PolicyController do
policy_details: p.policy_details,
selected_providers: p.selected_providers,
quotes: p.quotes,
accepted_quote_id: p.accepted_quote_id,
accepted_plan_id: p.accepted_plan_id,
accepted_provider_id: p.accepted_provider_id,
accepted_at: p.accepted_at,
solicitation_id: p.solicitation_id,
solicitation_s3_key: p.solicitation_s3_key,
policy_number: p.policy_number,
accepted_by: p.accepted_by,
provider_policy_number: p.provider_policy_number,
premium: p.premium,
effective_date: p.effective_date,
expiry_date: p.expiry_date,