This commit is contained in:
@@ -31,7 +31,7 @@ defmodule CustomerService.Aggregates.CustomerId do
|
||||
end
|
||||
|
||||
defimpl String.Chars do
|
||||
def to_string(%CustomerService.Aggregates.LeadId{
|
||||
def to_string(%CustomerService.Aggregates.CustomerId{
|
||||
org_id: org_id,
|
||||
customer_type: type,
|
||||
customer_id: customer_id
|
||||
|
||||
@@ -13,7 +13,7 @@ defmodule CustomerService.Projectors.Customer do
|
||||
%CustomerService.Aggregates.CustomerId{org_id: org_id, customer_id: customer_id} = event.id
|
||||
|
||||
Ecto.Multi.insert(multi, :customer, %Customer{
|
||||
id: CustomerId.to_string(event.id),
|
||||
id: to_string(event.id),
|
||||
org_id: org_id,
|
||||
customer_id: customer_id,
|
||||
customer_type: "individual",
|
||||
@@ -42,7 +42,7 @@ defmodule CustomerService.Projectors.Customer do
|
||||
%CustomerService.Aggregates.CustomerId{org_id: org_id, customer_id: customer_id} = e.id
|
||||
|
||||
Ecto.Multi.insert(multi, :customer, %Customer{
|
||||
id: CustomerId.to_string(e.id),
|
||||
id: to_string(e.id),
|
||||
org_id: org_id,
|
||||
customer_id: customer_id,
|
||||
customer_type: "corporate",
|
||||
@@ -58,7 +58,7 @@ defmodule CustomerService.Projectors.Customer do
|
||||
end)
|
||||
|
||||
project(%Events.CustomerUpdated{} = e, _meta, fn multi ->
|
||||
composite_id = CustomerId.to_string(e.id)
|
||||
composite_id = to_string(e.id)
|
||||
|
||||
Ecto.Multi.update_all(multi, :customer, from(c in Customer, where: c.id == ^composite_id),
|
||||
set: [
|
||||
@@ -75,7 +75,7 @@ defmodule CustomerService.Projectors.Customer do
|
||||
end)
|
||||
|
||||
project(%Events.CorporateCustomerUpdated{} = e, _meta, fn multi ->
|
||||
composite_id = CustomerId.to_string(e.id)
|
||||
composite_id = to_string(e.id)
|
||||
|
||||
Ecto.Multi.update_all(multi, :customer, from(c in Customer, where: c.id == ^composite_id),
|
||||
set: [
|
||||
|
||||
@@ -13,7 +13,7 @@ defmodule CustomerService.Projectors.QuickLead do
|
||||
%CustomerService.Aggregates.LeadId{org_id: org_id, lead_id: lead_id} = event.id
|
||||
|
||||
Ecto.Multi.insert(multi, :quick_lead, %QuickLead{
|
||||
id: LeadId.to_string(event.id),
|
||||
id: to_string(event.id),
|
||||
org_id: org_id,
|
||||
lead_id: lead_id,
|
||||
name: event.name,
|
||||
@@ -38,7 +38,7 @@ defmodule CustomerService.Projectors.QuickLead do
|
||||
end)
|
||||
|
||||
project(%Events.QuickLeadUpdated{} = event, _meta, fn multi ->
|
||||
composite_id = LeadId.to_string(event.id)
|
||||
composite_id = to_string(event.id)
|
||||
|
||||
Ecto.Multi.update_all(multi, :quick_lead, from(q in QuickLead, where: q.id == ^composite_id),
|
||||
set: [
|
||||
@@ -55,7 +55,7 @@ defmodule CustomerService.Projectors.QuickLead do
|
||||
end)
|
||||
|
||||
project(%Events.LeadStatusUpdated{} = event, _meta, fn multi ->
|
||||
composite_id = LeadId.to_string(event.id)
|
||||
composite_id = to_string(event.id)
|
||||
|
||||
Ecto.Multi.update_all(multi, :quick_lead, from(q in QuickLead, where: q.id == ^composite_id),
|
||||
set: [
|
||||
|
||||
Reference in New Issue
Block a user