rename policy_details to insured_object
All checks were successful
Build and Publish / build-release (push) Successful in 1m36s
All checks were successful
Build and Publish / build-release (push) Successful in 1m36s
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
defmodule PolicyService.Aggregates.PolicyApplication do
|
||||
@moduledoc """
|
||||
Behaviour and __using__ macro for policy application aggregates.
|
||||
Each policy type implements validate_details/1 and declares its detail fields.
|
||||
Each policy type implements validate_insured_object/1 and declares its insured object fields.
|
||||
|
||||
Usage:
|
||||
defmodule PolicyService.Aggregates.CarPolicyApplication do
|
||||
@@ -10,7 +10,7 @@ defmodule PolicyService.Aggregates.PolicyApplication do
|
||||
end
|
||||
"""
|
||||
|
||||
@callback validate_details(map()) :: :ok | {:error, term()}
|
||||
@callback validate_insured_object(map()) :: :ok | {:error, term()}
|
||||
|
||||
defmacro __using__(opts) do
|
||||
policy_type = Keyword.fetch!(opts, :policy_type)
|
||||
@@ -41,7 +41,7 @@ defmodule PolicyService.Aggregates.PolicyApplication do
|
||||
:submitted_by,
|
||||
:insured,
|
||||
:buyer,
|
||||
:policy_details,
|
||||
:insured_object,
|
||||
:selected_providers,
|
||||
:accepted_plan_id,
|
||||
:accepted_by,
|
||||
@@ -61,7 +61,7 @@ defmodule PolicyService.Aggregates.PolicyApplication do
|
||||
:ok <- validate_insured(cmd.insured),
|
||||
:ok <-
|
||||
PolicyService.Aggregates.PolicyApplication.validate_buyer(cmd.buyer),
|
||||
:ok <- validate_details(cmd.policy_details),
|
||||
:ok <- validate_insured_object(cmd.insured_object),
|
||||
:ok <-
|
||||
PolicyService.Aggregates.PolicyApplication.validate_providers(
|
||||
cmd.selected_providers
|
||||
@@ -74,7 +74,7 @@ defmodule PolicyService.Aggregates.PolicyApplication do
|
||||
provider_email: provider.email,
|
||||
insured: cmd.insured,
|
||||
buyer: cmd.buyer,
|
||||
policy_details: cmd.policy_details,
|
||||
insured_object: cmd.insured_object,
|
||||
requested_at: DateTime.utc_now()
|
||||
}
|
||||
end)
|
||||
@@ -85,7 +85,7 @@ defmodule PolicyService.Aggregates.PolicyApplication do
|
||||
submitted_by: cmd.submitted_by,
|
||||
insured: cmd.insured,
|
||||
buyer: cmd.buyer,
|
||||
policy_details: cmd.policy_details,
|
||||
insured_object: cmd.insured_object,
|
||||
selected_providers: cmd.selected_providers,
|
||||
submitted_at: DateTime.utc_now()
|
||||
}
|
||||
@@ -192,7 +192,7 @@ defmodule PolicyService.Aggregates.PolicyApplication do
|
||||
submitted_by: e.submitted_by,
|
||||
insured: e.insured,
|
||||
buyer: e.buyer,
|
||||
policy_details: e.policy_details,
|
||||
insured_object: e.insured_object,
|
||||
selected_providers: e.selected_providers,
|
||||
quotes: %{},
|
||||
state: :awaiting_quotes
|
||||
|
||||
Reference in New Issue
Block a user