refactor use cases

This commit is contained in:
2026-01-08 15:34:51 +01:00
parent d984ab24a8
commit 52e9a2f6a7
362 changed files with 5192 additions and 8409 deletions

View File

@@ -1,4 +1,4 @@
import type { Logger, UseCaseOutputPort, UseCase } from '@core/shared/application';
import type { Logger, UseCase } from '@core/shared/application';
import { Result } from '@core/shared/application/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
@@ -13,13 +13,12 @@ export interface GetDashboardDataOutput {
export type GetDashboardDataErrorCode = 'REPOSITORY_ERROR';
export class GetDashboardDataUseCase implements UseCase<GetDashboardDataInput, void, GetDashboardDataErrorCode> {
export class GetDashboardDataUseCase implements UseCase<GetDashboardDataInput, GetDashboardDataOutput, GetDashboardDataErrorCode> {
constructor(
private readonly logger: Logger,
private readonly output: UseCaseOutputPort<GetDashboardDataOutput>,
) {}
async execute(): Promise<Result<void, ApplicationErrorCode<GetDashboardDataErrorCode, { message: string }>>> {
async execute(): Promise<Result<GetDashboardDataOutput, ApplicationErrorCode<GetDashboardDataErrorCode, { message: string }>>> {
try {
// Placeholder implementation - would need repositories from identity and racing domains
const totalUsers = 0;
@@ -34,8 +33,6 @@ export class GetDashboardDataUseCase implements UseCase<GetDashboardDataInput, v
totalLeagues,
};
this.output.present(resultModel);
this.logger.info('Dashboard data retrieved', {
totalUsers,
activeUsers,
@@ -43,7 +40,7 @@ export class GetDashboardDataUseCase implements UseCase<GetDashboardDataInput, v
totalLeagues,
});
return Result.ok(undefined);
return Result.ok(resultModel);
} catch (error) {
const err = error as Error;
this.logger.error('Failed to get dashboard data', err);