cover/Elixir.WalletAuth.Events.AuthSessionStarted.html

1 defmodule WalletAuth.Events.AuthSessionStarted do
2 @moduledoc "Emitted when an authenticated session is created."
3 @behaviour WalletEvents.DomainEvent
4
5 @impl true
6 1 def event_name, do: "AuthSessionStarted.v1"
7
8 @impl true
9 1 def event_version, do: 1
10
11
:-(
def build(session_id, user_id, opts \\ []) do
12 1 %{
13 event_id: WalletSharedKernel.Correlation.new_request_id(),
14 event_name: event_name(),
15 event_version: event_version(),
16 aggregate_id: session_id,
17 correlation_id: Keyword.get(opts, :correlation_id, WalletSharedKernel.Correlation.new_correlation_id()),
18 occurred_at: DateTime.utc_now(),
19 payload: %{
20 session_id: session_id,
21 user_id: user_id,
22 device_id: Keyword.get(opts, :device_id),
23 ip_address: Keyword.get(opts, :ip_address),
24 user_agent: Keyword.get(opts, :user_agent)
25 }
26 }
27 end
28 end
Line Hits Source