Files
policy-service/lib/policy_service/commanded_app.ex
HaimKortovich a7160aadcf
All checks were successful
Build and Publish / build-release (push) Successful in 1m41s
revamp aggregate and use typestruct
2026-04-22 11:37:04 -05:00

34 lines
985 B
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 Fire commands to Fire Aggregate
dispatch(
[
PolicyService.Commands.FirePolicy.SubmitPolicyApplication,
PolicyService.Commands.FirePolicy.RecordProviderQuote,
PolicyService.Commands.FirePolicy.AcceptQuoteAndSolicit,
PolicyService.Commands.FirePolicy.RecordPolicyIssued
],
to: PolicyService.Aggregates.FirePolicyApplication,
identity: :id
)
end
defmodule PolicyService.CommandedApp do
use Commanded.Application,
otp_app: :policy_service
router(PolicyService.Router)
end