fix issues in core

This commit is contained in:
2025-12-23 16:16:12 +01:00
parent 120d3bb1a1
commit d04a21fe02
40 changed files with 280 additions and 841 deletions

View File

@@ -1,8 +1,27 @@
import type { AuthenticatedUserDTO } from '../dto/AuthenticatedUserDTO';
import type { AuthCallbackCommandDTO } from '../dto/AuthCallbackCommandDTO';
import type { StartAuthCommandDTO } from '../dto/StartAuthCommandDTO';
export type AuthProvider = 'IRACING_DEMO';
export interface StartAuthCommand {
provider: AuthProvider;
returnTo?: string;
}
export interface AuthCallbackCommand {
provider: AuthProvider;
code: string;
state: string;
returnTo?: string;
}
export interface AuthenticatedUser {
id: string;
displayName: string;
email?: string;
iracingCustomerId?: string;
primaryDriverId?: string;
avatarUrl?: string;
}
export interface IdentityProviderPort {
startAuth(command: StartAuthCommandDTO): Promise<{ redirectUrl: string; state: string }>;
completeAuth(command: AuthCallbackCommandDTO): Promise<AuthenticatedUserDTO>;
startAuth(command: StartAuthCommand): Promise<{ redirectUrl: string; state: string }>;
completeAuth(command: AuthCallbackCommand): Promise<AuthenticatedUser>;
}

View File

@@ -1,10 +1,15 @@
import type { AuthenticatedUserDTO } from '../dto/AuthenticatedUserDTO';
import type { AuthSessionDTO } from '../dto/AuthSessionDTO';
import type { AuthenticatedUser } from './IdentityProviderPort';
// TODO not so sure if this here is proper clean architecture
export interface AuthSession {
user: AuthenticatedUser;
issuedAt: number;
expiresAt: number;
token: string;
}
// Application port for session access/persistence (implemented by adapters).
export interface IdentitySessionPort {
getCurrentSession(): Promise<AuthSessionDTO | null>;
createSession(user: AuthenticatedUserDTO): Promise<AuthSessionDTO>;
getCurrentSession(): Promise<AuthSession | null>;
createSession(user: AuthenticatedUser): Promise<AuthSession>;
clearSession(): Promise<void>;
}