rename to core

This commit is contained in:
2025-12-15 13:46:07 +01:00
parent aedf58643d
commit 5c22f8820c
559 changed files with 415 additions and 767 deletions

View File

@@ -0,0 +1,39 @@
import { Result } from '../../../shared/result/Result';
import type { AuthenticationServicePort } from '../ports/AuthenticationServicePort';
import type { ILogger } from '../../../shared/logger/ILogger';
/**
* Use case for initiating the manual login flow.
*
* Opens a visible browser window where the user can log into iRacing directly.
* GridPilot never sees the credentials - it only waits for the URL to change
* indicating successful login.
*/
export class InitiateLoginUseCase {
constructor(
private readonly authService: AuthenticationServicePort,
private readonly logger: ILogger,
) {}
/**
* Execute the login flow.
* Opens browser and waits for user to complete manual login.
*
* @returns Result indicating success (login complete) or failure (cancelled/timeout)
*/
async execute(): Promise<Result<void>> {
this.logger.debug('Initiating login flow...');
try {
const result = await this.authService.initiateLogin();
if (result.isOk()) {
this.logger.info('Login flow initiated successfully.');
} else {
this.logger.warn('Login flow initiation failed.', { error: result.error });
}
return result;
} catch (error: any) {
this.logger.error('Error initiating login flow.', error);
return Result.fail(error.message || 'Unknown error during login initiation.');
}
}
}