team rating

This commit is contained in:
2025-12-30 12:25:45 +01:00
parent ccaa39c39c
commit 83371ea839
93 changed files with 10324 additions and 490 deletions

View File

@@ -0,0 +1,70 @@
/**
* Infrastructure Adapter: InMemoryMediaRepository
*
* In-memory implementation of IMediaRepository.
* Stores URLs for static media assets like logos and images.
*/
import type { IMediaRepository } from '@core/racing/domain/repositories/IMediaRepository';
import type { Logger } from '@core/shared/application';
export class InMemoryMediaRepository implements IMediaRepository {
private driverAvatars = new Map<string, string>();
private teamLogos = new Map<string, string>();
private trackImages = new Map<string, string>();
private categoryIcons = new Map<string, string>();
private sponsorLogos = new Map<string, string>();
constructor(private readonly logger: Logger) {
this.logger.info('[InMemoryMediaRepository] Initialized.');
}
async getDriverAvatar(driverId: string): Promise<string | null> {
return this.driverAvatars.get(driverId) ?? null;
}
async getTeamLogo(teamId: string): Promise<string | null> {
return this.teamLogos.get(teamId) ?? null;
}
async getTrackImage(trackId: string): Promise<string | null> {
return this.trackImages.get(trackId) ?? null;
}
async getCategoryIcon(categoryId: string): Promise<string | null> {
return this.categoryIcons.get(categoryId) ?? null;
}
async getSponsorLogo(sponsorId: string): Promise<string | null> {
return this.sponsorLogos.get(sponsorId) ?? null;
}
// Helper methods for seeding
setDriverAvatar(driverId: string, url: string): void {
this.driverAvatars.set(driverId, url);
}
setTeamLogo(teamId: string, url: string): void {
this.teamLogos.set(teamId, url);
}
setTrackImage(trackId: string, url: string): void {
this.trackImages.set(trackId, url);
}
setCategoryIcon(categoryId: string, url: string): void {
this.categoryIcons.set(categoryId, url);
}
setSponsorLogo(sponsorId: string, url: string): void {
this.sponsorLogos.set(sponsorId, url);
}
async clear(): Promise<void> {
this.driverAvatars.clear();
this.teamLogos.clear();
this.trackImages.clear();
this.categoryIcons.clear();
this.sponsorLogos.clear();
}
}