wip
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user