more seeds
This commit is contained in:
@@ -44,17 +44,20 @@ export class LeagueService {
|
||||
* Get all leagues with view model transformation
|
||||
*/
|
||||
async getAllLeagues(): Promise<LeagueSummaryViewModel[]> {
|
||||
const dto = await this.apiClient.getAllWithCapacity();
|
||||
return dto.leagues.map((league: LeagueWithCapacityDTO) => ({
|
||||
const dto = await this.apiClient.getAllWithCapacityAndScoring();
|
||||
|
||||
return dto.leagues.map((league) => ({
|
||||
id: league.id,
|
||||
name: league.name,
|
||||
description: (league as any).description ?? '',
|
||||
ownerId: (league as any).ownerId ?? '',
|
||||
createdAt: (league as any).createdAt ?? '',
|
||||
maxDrivers: (league as any).settings?.maxDrivers ?? 0,
|
||||
usedDriverSlots: (league as any).usedSlots ?? 0,
|
||||
structureSummary: 'TBD',
|
||||
timingSummary: 'TBD'
|
||||
description: league.description,
|
||||
ownerId: league.ownerId,
|
||||
createdAt: league.createdAt,
|
||||
maxDrivers: league.settings?.maxDrivers ?? 0,
|
||||
usedDriverSlots: league.usedSlots ?? 0,
|
||||
structureSummary: league.scoring?.scoringPresetName ?? 'Custom rules',
|
||||
scoringPatternSummary: league.scoring?.scoringPatternSummary,
|
||||
timingSummary: league.timingSummary ?? '',
|
||||
...(league.scoring ? { scoring: league.scoring } : {}),
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -162,16 +165,16 @@ export class LeagueService {
|
||||
// For now, assume league data comes from getAllWithCapacity or a new endpoint
|
||||
// Since API may not have detailed league, we'll mock or assume
|
||||
// In real implementation, add getLeagueDetail to API
|
||||
const allLeagues = await this.apiClient.getAllWithCapacity();
|
||||
const leagueDto = allLeagues.leagues.find((l: any) => l.id === leagueId);
|
||||
const allLeagues = await this.apiClient.getAllWithCapacityAndScoring();
|
||||
const leagueDto = allLeagues.leagues.find((l) => l.id === leagueId);
|
||||
if (!leagueDto) return null;
|
||||
|
||||
// LeagueWithCapacityDTO already carries core fields; fall back to placeholder description/owner when not provided
|
||||
const league = {
|
||||
id: leagueDto.id,
|
||||
name: leagueDto.name,
|
||||
description: (leagueDto as any).description ?? 'Description not available',
|
||||
ownerId: (leagueDto as any).ownerId ?? 'owner-id',
|
||||
description: leagueDto.description ?? 'Description not available',
|
||||
ownerId: leagueDto.ownerId ?? 'owner-id',
|
||||
};
|
||||
|
||||
// Get owner
|
||||
@@ -245,12 +248,12 @@ export class LeagueService {
|
||||
|
||||
try {
|
||||
// Get league basic info
|
||||
const allLeagues = await this.apiClient.getAllWithCapacity();
|
||||
const league = allLeagues.leagues.find((l: any) => l.id === leagueId);
|
||||
const allLeagues = await this.apiClient.getAllWithCapacityAndScoring();
|
||||
const league = allLeagues.leagues.find((l) => l.id === leagueId);
|
||||
if (!league) return null;
|
||||
|
||||
// Get owner
|
||||
const owner = await this.driversApiClient.getDriver((league as any).ownerId);
|
||||
const owner = await this.driversApiClient.getDriver(league.ownerId);
|
||||
|
||||
// League scoring configuration is not exposed separately yet; use null to indicate "not configured" in the UI
|
||||
const scoringConfig: LeagueScoringConfigDTO | null = null;
|
||||
|
||||
Reference in New Issue
Block a user