refactor core presenters

This commit is contained in:
2025-12-19 19:42:19 +01:00
parent 8116fe888f
commit 94fc538f44
228 changed files with 2817 additions and 3097 deletions

View File

@@ -5,7 +5,7 @@
*/
import type { ISponsorRepository } from '../../domain/repositories/ISponsorRepository';
import type { GetSponsorsViewModel } from '../presenters/IGetSponsorsPresenter';
import type { GetSponsorsOutputPort } from '../ports/output/GetSponsorsOutputPort';
import { Result } from '@core/shared/application/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
@@ -14,11 +14,11 @@ export class GetSponsorsUseCase {
private readonly sponsorRepository: ISponsorRepository,
) {}
async execute(): Promise<Result<GetSponsorsViewModel, ApplicationErrorCode<'REPOSITORY_ERROR'>>> {
async execute(): Promise<Result<GetSponsorsOutputPort, ApplicationErrorCode<'REPOSITORY_ERROR'>>> {
try {
const sponsors = await this.sponsorRepository.findAll();
const viewModel: GetSponsorsViewModel = {
const outputPort: GetSponsorsOutputPort = {
sponsors: sponsors.map(sponsor => ({
id: sponsor.id,
name: sponsor.name,
@@ -29,7 +29,7 @@ export class GetSponsorsUseCase {
})),
};
return Result.ok(viewModel);
return Result.ok(outputPort);
} catch {
return Result.err({ code: 'REPOSITORY_ERROR', message: 'Failed to fetch sponsors' });
}