Some checks are pending
Build and Publish / build-release (push) Waiting to run
35 lines
986 B
Elixir
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
|