This commit is contained in:
2025-12-12 14:23:40 +01:00
parent 6a88fe93ab
commit 2cd3bfbb47
58 changed files with 2866 additions and 260 deletions

View File

@@ -282,10 +282,34 @@ export class InMemorySeasonRepository implements ISeasonRepository {
}
async create(season: Season): Promise<Season> {
// Backward-compatible alias for add()
this.seasons.push(season);
return season;
}
async add(season: Season): Promise<void> {
this.seasons.push(season);
}
async update(season: Season): Promise<void> {
const index = this.seasons.findIndex((s) => s.id === season.id);
if (index === -1) {
this.seasons.push(season);
return;
}
this.seasons[index] = season;
}
async listByLeague(leagueId: string): Promise<Season[]> {
return this.seasons.filter((s) => s.leagueId === leagueId);
}
async listActiveByLeague(leagueId: string): Promise<Season[]> {
return this.seasons.filter(
(s) => s.leagueId === leagueId && s.status === 'active',
);
}
seed(season: Season): void {
this.seasons.push(season);
}

View File

@@ -18,6 +18,10 @@ export class InMemorySeasonSponsorshipRepository implements ISeasonSponsorshipRe
return Array.from(this.sponsorships.values()).filter(s => s.seasonId === seasonId);
}
async findByLeagueId(leagueId: string): Promise<SeasonSponsorship[]> {
return Array.from(this.sponsorships.values()).filter(s => s.leagueId === leagueId);
}
async findBySponsorId(sponsorId: string): Promise<SeasonSponsorship[]> {
return Array.from(this.sponsorships.values()).filter(s => s.sponsorId === sponsorId);
}