From ef843cd60019a33579cb2ad138ebcfb94c46600d Mon Sep 17 00:00:00 2001 From: Laura Beatris <48022589+LauraBeatris@users.noreply.github.com> Date: Tue, 26 Mar 2024 16:51:35 -0300 Subject: [PATCH] Add `status` to authentication event type --- .../interfaces/authentication-event.interface.ts | 16 ++++++++++------ .../authentication-event.serializer.ts | 5 +++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/user-management/interfaces/authentication-event.interface.ts b/src/user-management/interfaces/authentication-event.interface.ts index ed4b6ac25..0254958b6 100644 --- a/src/user-management/interfaces/authentication-event.interface.ts +++ b/src/user-management/interfaces/authentication-event.interface.ts @@ -3,7 +3,7 @@ interface AuthenticationEventError { message: string; } -export type AuthenticationEventType = +type AuthenticationEventType = | 'sso' | 'password' | 'oauth' @@ -11,20 +11,24 @@ export type AuthenticationEventType = | 'magic_auth' | 'email_verification'; +type AuthenticationEventStatus = 'failed' | 'succeeded'; + export type AuthenticationEvent = { - type: AuthenticationEventType; - email?: string | null; + email: string | null; + error?: AuthenticationEventError; ipAddress: string | null; + status: AuthenticationEventStatus; + type: AuthenticationEventType; userAgent: string | null; userId: string | null; - error?: AuthenticationEventError; }; export interface AuthenticationEventResponse { - type: AuthenticationEventType; email: string | null; + error?: AuthenticationEventError; ip_address: string | null; + status: AuthenticationEventStatus; + type: AuthenticationEventType; user_agent: string | null; user_id: string | null; - error: AuthenticationEventError | null; } diff --git a/src/user-management/serializers/authentication-event.serializer.ts b/src/user-management/serializers/authentication-event.serializer.ts index 7a7cd8ac3..49fc33892 100644 --- a/src/user-management/serializers/authentication-event.serializer.ts +++ b/src/user-management/serializers/authentication-event.serializer.ts @@ -6,10 +6,11 @@ import { export const deserializeAuthenticationEvent = ( authenticationEvent: AuthenticationEventResponse, ): AuthenticationEvent => ({ - type: authenticationEvent.type, email: authenticationEvent.email, + error: authenticationEvent.error, ipAddress: authenticationEvent.ip_address, + status: authenticationEvent.status, + type: authenticationEvent.type, userAgent: authenticationEvent.user_agent, userId: authenticationEvent.user_id, - error: authenticationEvent.error, });