From 39fdd375ae77605facb75fe92876b675fc9fc351 Mon Sep 17 00:00:00 2001 From: Laura Beatris <48022589+LauraBeatris@users.noreply.github.com> Date: Tue, 26 Mar 2024 14:47:30 -0300 Subject: [PATCH] Introduce payloads per type --- .../authentication-event.interface.ts | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/user-management/interfaces/authentication-event.interface.ts b/src/user-management/interfaces/authentication-event.interface.ts index a40bf489d..fa38c6d95 100644 --- a/src/user-management/interfaces/authentication-event.interface.ts +++ b/src/user-management/interfaces/authentication-event.interface.ts @@ -3,22 +3,25 @@ interface AuthenticationEventError { message: string; } -export type AuthenticationEventType = - | 'email_verification' - | 'magic_auth' - | 'mfa' - | 'oauth' - | 'password' - | 'sso'; +interface AuthenticationEventTypes { + 'sso': {}, + 'password': {}, + 'oauth': {}, + 'mfa': {}, + 'magic_auth': {}, + 'email_verification': {}, +} + +export type AuthenticationEventType = keyof AuthenticationEventTypes; -export interface AuthenticationEvent { +export type AuthenticationEvent = { type: T; email: string; ipAddress: string | null; userAgent: string | null; userId: string | null; error?: AuthenticationEventError; -} +} & Partial> export interface AuthenticationEventResponse< T extends AuthenticationEventType,