Skip to content

Commit

Permalink
Introduce payloads per type
Browse files Browse the repository at this point in the history
  • Loading branch information
LauraBeatris committed Mar 26, 2024
1 parent da36218 commit 39fdd37
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/user-management/interfaces/authentication-event.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T extends AuthenticationEventType> {
export type AuthenticationEvent<T extends AuthenticationEventType> = {
type: T;
email: string;
ipAddress: string | null;
userAgent: string | null;
userId: string | null;
error?: AuthenticationEventError;
}
} & Partial<Pick<AuthenticationEventTypes, T>>

export interface AuthenticationEventResponse<
T extends AuthenticationEventType,
Expand Down

0 comments on commit 39fdd37

Please sign in to comment.