Files
policy-service/lib/policy_service/commanded_app.ex
HaimKortovich 5037bc3632
Some checks are pending
Build and Publish / build-release (push) Waiting to run
wip
2026-04-13 15:30:31 -05:00

35 lines
986 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