fix search and insured override
All checks were successful
Build and Publish / build-release (push) Successful in 1m50s

This commit is contained in:
2026-04-30 11:35:27 -05:00
parent b5686f890a
commit 42cb25a3b6
3 changed files with 34 additions and 27 deletions

View File

@@ -33,5 +33,11 @@ defmodule PolicyService.Aggregates.LifePolicyApplication do
def validate_details(_), do: {:error, :invalid_life_details}
def validate_insured(%{"type" => "corporate"}), do: {:error, :life_insurance_requires_individual}
def validate_insured(insured), do: super(insured)
def validate_insured(%{"type" => "individual", "gender" => gender} = insured)
when is_binary(gender) and byte_size(gender) > 0 do
super(insured)
end
def validate_insured(%{"type" => "individual"}), do: {:error, :missing_gender}
end