This commit is contained in:
2025-12-14 18:11:59 +01:00
parent acc15e8d8d
commit 217337862c
91 changed files with 5919 additions and 1999 deletions

View File

@@ -1,5 +1,6 @@
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.
@@ -9,7 +10,10 @@ import type { AuthenticationServicePort } from '../ports/AuthenticationServicePo
* indicating successful login.
*/
export class InitiateLoginUseCase {
constructor(private readonly authService: AuthenticationServicePort) {}
constructor(
private readonly authService: AuthenticationServicePort,
private readonly logger: ILogger,
) {}
/**
* Execute the login flow.
@@ -18,6 +22,18 @@ export class InitiateLoginUseCase {
* @returns Result indicating success (login complete) or failure (cancelled/timeout)
*/
async execute(): Promise<Result<void>> {
return this.authService.initiateLogin();
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.');
}
}
}