website cleanup

This commit is contained in:
2025-12-24 21:44:58 +01:00
parent 9b683a59d3
commit d78854a4c6
277 changed files with 6141 additions and 2693 deletions

View File

@@ -1,6 +1,6 @@
import { Controller, Get, Post, Body, Query } from '@nestjs/common';
import { AuthService } from './AuthService';
import { LoginParams, SignupParams, AuthSessionDTO } from './dtos/AuthDto';
import { LoginParamsDTO, SignupParamsDTO, AuthSessionDTO } from './dtos/AuthDto';
import type { CommandResultDTO } from './presenters/CommandResultPresenter';
@Controller('auth')
@@ -8,12 +8,12 @@ export class AuthController {
constructor(private readonly authService: AuthService) {}
@Post('signup')
async signup(@Body() params: SignupParams): Promise<AuthSessionDTO> {
async signup(@Body() params: SignupParamsDTO): Promise<AuthSessionDTO> {
return this.authService.signupWithEmail(params);
}
@Post('login')
async login(@Body() params: LoginParams): Promise<AuthSessionDTO> {
async login(@Body() params: LoginParamsDTO): Promise<AuthSessionDTO> {
return this.authService.loginWithEmail(params);
}

View File

@@ -26,7 +26,7 @@ import {
SIGNUP_USE_CASE_TOKEN,
} from './AuthProviders';
import type { AuthSessionDTO } from './dtos/AuthDto';
import { LoginParams, SignupParams } from './dtos/AuthDto';
import { LoginParamsDTO, SignupParamsDTO } from './dtos/AuthDto';
import { AuthSessionPresenter } from './presenters/AuthSessionPresenter';
import type { CommandResultDTO } from './presenters/CommandResultPresenter';
import { CommandResultPresenter } from './presenters/CommandResultPresenter';
@@ -67,7 +67,7 @@ export class AuthService {
};
}
async signupWithEmail(params: SignupParams): Promise<AuthSessionDTO> {
async signupWithEmail(params: SignupParamsDTO): Promise<AuthSessionDTO> {
this.logger.debug(`[AuthService] Attempting signup for email: ${params.email}`);
this.authSessionPresenter.reset();
@@ -98,7 +98,7 @@ export class AuthService {
};
}
async loginWithEmail(params: LoginParams): Promise<AuthSessionDTO> {
async loginWithEmail(params: LoginParamsDTO): Promise<AuthSessionDTO> {
this.logger.debug(`[AuthService] Attempting login for email: ${params.email}`);
this.authSessionPresenter.reset();
@@ -142,4 +142,51 @@ export class AuthService {
return this.commandResultPresenter.responseModel;
}
/**
* Start iRacing OAuth flow.
*
* NOTE: This is a placeholder implementation for the current alpha build.
* A production implementation should delegate to a dedicated iRacing OAuth port
* and persist/validate state server-side.
*/
async startIracingAuth(returnTo?: string): Promise<string> {
this.logger.debug('[AuthService] Starting iRacing auth flow', { returnTo });
const state = Math.random().toString(36).slice(2);
const base = 'https://example.com/iracing/auth';
const query = new URLSearchParams();
query.set('state', state);
if (returnTo) {
query.set('returnTo', returnTo);
}
return `${base}?${query.toString()}`;
}
/**
* Handle iRacing OAuth callback.
*
* NOTE: Placeholder implementation that creates a demo session.
*/
async iracingCallback(code: string, state: string, returnTo?: string): Promise<AuthSessionDTO> {
this.logger.debug('[AuthService] iRacing callback received', { hasCode: !!code, state, returnTo });
const userId = `iracing-${state || code}`.slice(0, 64);
const session = await this.identitySessionPort.createSession({
id: userId,
displayName: 'iRacing User',
email: '',
});
return {
token: session.token,
user: {
userId,
email: '',
displayName: 'iRacing User',
},
};
}
}

View File

@@ -16,7 +16,7 @@ export class AuthSessionDTO {
user!: AuthenticatedUserDTO;
}
export class SignupParams {
export class SignupParamsDTO {
@ApiProperty()
email!: string;
@ApiProperty()
@@ -31,21 +31,21 @@ export class SignupParams {
avatarUrl?: string;
}
export class LoginParams {
export class LoginParamsDTO {
@ApiProperty()
email!: string;
@ApiProperty()
password!: string;
}
export class IracingAuthRedirectResult {
export class IracingAuthRedirectResultDTO {
@ApiProperty()
redirectUrl!: string;
@ApiProperty()
state!: string;
}
export class LoginWithIracingCallbackParams {
export class LoginWithIracingCallbackParamsDTO {
@ApiProperty()
code!: string;
@ApiProperty()