website refactor

This commit is contained in:
2026-01-16 15:20:25 +01:00
parent 7e02fc3ea5
commit 37b1aa626c
325 changed files with 2167 additions and 2782 deletions

View File

@@ -1,6 +1,7 @@
import type { Sponsor } from '../../domain/entities/sponsor/Sponsor';
import type { SponsorRepository } from '../../domain/repositories/SponsorRepository';
import { Result } from '@core/shared/domain/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
export interface GetSponsorsInput {}
@@ -8,11 +9,20 @@ export interface GetSponsorsResult {
sponsors: Sponsor[];
}
export class GetSponsorsUseCase {
constructor(private readonly sponsorRepository: ISponsorRepository) {}
export type GetSponsorsErrorCode = 'REPOSITORY_ERROR';
async execute(_input: GetSponsorsInput): Promise<Result<GetSponsorsResult, never>> {
const sponsors = await this.sponsorRepository.findAll();
return Result.ok({ sponsors });
export class GetSponsorsUseCase {
constructor(private readonly sponsorRepository: SponsorRepository) {}
async execute(_input: GetSponsorsInput): Promise<Result<GetSponsorsResult, ApplicationErrorCode<GetSponsorsErrorCode, { message: string }>>> {
try {
const sponsors = await this.sponsorRepository.findAll();
return Result.ok({ sponsors });
} catch (error) {
return Result.err({
code: 'REPOSITORY_ERROR',
details: { message: error instanceof Error ? error.message : 'Unknown error' },
});
}
}
}
}