This commit is contained in:
@@ -4,7 +4,7 @@ defmodule CustomerService.Aggregates.CustomerId do
|
||||
customer_type: String.t(),
|
||||
customer_id: String.t()
|
||||
}
|
||||
@derive {Jason.Encoder, only: [:org_id, :customer_type, :customer_id]}
|
||||
@derive Jason.Encoder
|
||||
defstruct [:org_id, :customer_type, :customer_id]
|
||||
|
||||
def new(org_id, customer_type, customer_id)
|
||||
@@ -30,12 +30,14 @@ defmodule CustomerService.Aggregates.CustomerId do
|
||||
{:error, :invalid_customer_id}
|
||||
end
|
||||
|
||||
def to_string(%__MODULE__{
|
||||
org_id: org_id,
|
||||
customer_type: customer_type,
|
||||
customer_id: customer_id
|
||||
}) do
|
||||
org_id <> ":" <> customer_type <> ":" <> customer_id
|
||||
defimpl String.Chars do
|
||||
def to_string(%CustomerService.Aggregates.LeadId{
|
||||
org_id: org_id,
|
||||
customer_type: type,
|
||||
customer_id: customer_id
|
||||
}) do
|
||||
org_id <> ":" <> type <> ":" <> customer_id
|
||||
end
|
||||
end
|
||||
|
||||
defimpl Commanded.Serialization.JsonDecoder do
|
||||
|
||||
Reference in New Issue
Block a user