Skip to content

Commit

Permalink
Upcast version of the changed events
Browse files Browse the repository at this point in the history
  • Loading branch information
arbulu89 committed Sep 6, 2022
1 parent 085a403 commit ea9ddb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/trento/domain/host/events/host_details_updated.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule Trento.Domain.Events.HostDetailsUpdated do

use Trento.Event

defevent do
defevent version: 2 do
field :host_id, Ecto.UUID
field :hostname, :string
field :ip_addresses, {:array, :string}
Expand All @@ -20,4 +20,6 @@ defmodule Trento.Domain.Events.HostDetailsUpdated do
values: [:community, :suse, :unknown],
default: :unknown
end

def upcast(params, _, 2), do: Map.put(params, "installation_source", :unknown)
end
4 changes: 3 additions & 1 deletion lib/trento/domain/host/events/host_registered.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule Trento.Domain.Events.HostRegistered do

use Trento.Event

defevent do
defevent version: 2 do
field :host_id, Ecto.UUID
field :hostname, :string
field :ip_addresses, {:array, :string}
Expand All @@ -22,4 +22,6 @@ defmodule Trento.Domain.Events.HostRegistered do

field :heartbeat, Ecto.Enum, values: [:unknown]
end

def upcast(params, _, 2), do: Map.put(params, "installation_source", :unknown)
end

0 comments on commit ea9ddb9

Please sign in to comment.