Files
policy-service/lib/policy_service/commanded_app.ex
HaimKortovich 2a8f2ffc2d
All checks were successful
Build and Publish / build-release (push) Successful in 1m38s
refactor buyer and insured and add more policy types
2026-04-27 14:06:28 -05:00

59 lines
1.8 KiB
Elixir

defmodule PolicyService.Router do
use Commanded.Commands.Router
# Route Car commands to Car Aggregate
dispatch(
[
PolicyService.Commands.CarPolicy.SubmitPolicyApplication,
PolicyService.Commands.CarPolicy.RecordProviderQuote,
PolicyService.Commands.CarPolicy.AcceptQuoteAndSolicit,
PolicyService.Commands.CarPolicy.RecordPolicyIssued
],
to: PolicyService.Aggregates.CarPolicyApplication,
identity: :id
)
# Route Life commands to Life Aggregate
dispatch(
[
PolicyService.Commands.LifePolicy.SubmitPolicyApplication,
PolicyService.Commands.LifePolicy.RecordProviderQuote,
PolicyService.Commands.LifePolicy.AcceptQuoteAndSolicit,
PolicyService.Commands.LifePolicy.RecordPolicyIssued
],
to: PolicyService.Aggregates.LifePolicyApplication,
identity: :id
)
# Route FireStructure commands to FireStructure Aggregate
dispatch(
[
PolicyService.Commands.FireStructurePolicy.SubmitPolicyApplication,
PolicyService.Commands.FireStructurePolicy.RecordProviderQuote,
PolicyService.Commands.FireStructurePolicy.AcceptQuoteAndSolicit,
PolicyService.Commands.FireStructurePolicy.RecordPolicyIssued
],
to: PolicyService.Aggregates.FireStructurePolicyApplication,
identity: :id
)
# Route FireContents commands to FireContents Aggregate
dispatch(
[
PolicyService.Commands.FireContentsPolicy.SubmitPolicyApplication,
PolicyService.Commands.FireContentsPolicy.RecordProviderQuote,
PolicyService.Commands.FireContentsPolicy.AcceptQuoteAndSolicit,
PolicyService.Commands.FireContentsPolicy.RecordPolicyIssued
],
to: PolicyService.Aggregates.FireContentsPolicyApplication,
identity: :id
)
end
defmodule PolicyService.CommandedApp do
use Commanded.Application,
otp_app: :policy_service
router(PolicyService.Router)
end