properly decode policy id
Some checks failed
Build and Publish / build-release (push) Failing after 35s
Some checks failed
Build and Publish / build-release (push) Failing after 35s
This commit is contained in:
@@ -1,5 +1,25 @@
|
||||
defmodule PolicyService.Events.Policy do
|
||||
@moduledoc """
|
||||
Policy domain events.
|
||||
Contains helpers for common event functionality.
|
||||
"""
|
||||
|
||||
alias PolicyService.Aggregates.PolicyId
|
||||
|
||||
defmacro __using__(_opts) do
|
||||
quote do
|
||||
defimpl Commanded.Serialization.JsonDecoder do
|
||||
def decode(%{id: %{org_id: org_id, policy_type: policy_type, application_id: application_id}} = event) do
|
||||
%{event | id: PolicyId.new(org_id, policy_type, application_id)}
|
||||
end
|
||||
|
||||
def decode(event), do: event
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
defmodule PolicyApplicationSubmitted do
|
||||
use PolicyService.Events.Policy
|
||||
@derive Jason.Encoder
|
||||
defstruct [
|
||||
:id,
|
||||
@@ -12,6 +32,7 @@ defmodule PolicyService.Events.Policy do
|
||||
end
|
||||
|
||||
defmodule QuoteRequestSent do
|
||||
use PolicyService.Events.Policy
|
||||
@derive Jason.Encoder
|
||||
defstruct [
|
||||
:id,
|
||||
@@ -24,6 +45,7 @@ defmodule PolicyService.Events.Policy do
|
||||
end
|
||||
|
||||
defmodule ProviderQuoteReceived do
|
||||
use PolicyService.Events.Policy
|
||||
@derive Jason.Encoder
|
||||
defstruct [
|
||||
:id,
|
||||
@@ -39,11 +61,13 @@ defmodule PolicyService.Events.Policy do
|
||||
end
|
||||
|
||||
defmodule AllQuotesReceived do
|
||||
use PolicyService.Events.Policy
|
||||
@derive Jason.Encoder
|
||||
defstruct [:id, :quote_count]
|
||||
end
|
||||
|
||||
defmodule QuoteAccepted do
|
||||
use PolicyService.Events.Policy
|
||||
@derive Jason.Encoder
|
||||
defstruct [
|
||||
:id,
|
||||
@@ -56,6 +80,7 @@ defmodule PolicyService.Events.Policy do
|
||||
end
|
||||
|
||||
defmodule SolicitationSent do
|
||||
use PolicyService.Events.Policy
|
||||
@derive Jason.Encoder
|
||||
defstruct [
|
||||
:id,
|
||||
@@ -68,6 +93,7 @@ defmodule PolicyService.Events.Policy do
|
||||
end
|
||||
|
||||
defmodule PolicyIssued do
|
||||
use PolicyService.Events.Policy
|
||||
@derive Jason.Encoder
|
||||
defstruct [
|
||||
:id,
|
||||
|
||||
Reference in New Issue
Block a user