46 lines
1.6 KiB
TypeScript
46 lines
1.6 KiB
TypeScript
import { LeaguesApiClient } from '@/lib/api/leagues/LeaguesApiClient';
|
|
import { DriversApiClient } from '@/lib/api/drivers/DriversApiClient';
|
|
import { Result } from '@/lib/contracts/Result';
|
|
import { DomainError } from '@/lib/contracts/services/Service';
|
|
|
|
/**
|
|
* League Settings Service - DTO Only
|
|
*
|
|
* Returns raw API DTOs. No ViewModels or UX logic.
|
|
* All client-side presentation logic must be handled by hooks/components.
|
|
*/
|
|
export class LeagueSettingsService {
|
|
constructor(
|
|
private readonly leagueApiClient: LeaguesApiClient,
|
|
private readonly driverApiClient: DriversApiClient
|
|
) {}
|
|
|
|
async getLeagueSettings(leagueId: string): Promise<any> {
|
|
// This would typically call multiple endpoints to gather all settings data
|
|
// For now, return a basic structure
|
|
return {
|
|
league: await this.leagueApiClient.getAllWithCapacityAndScoring(),
|
|
config: { /* config data */ }
|
|
};
|
|
}
|
|
|
|
async transferOwnership(leagueId: string, currentOwnerId: string, newOwnerId: string): Promise<{ success: boolean }> {
|
|
return this.leagueApiClient.transferOwnership(leagueId, currentOwnerId, newOwnerId);
|
|
}
|
|
|
|
async selectScoringPreset(leagueId: string, preset: string): Promise<Result<void, DomainError>> {
|
|
return Result.err({ type: 'notImplemented', message: 'selectScoringPreset' });
|
|
}
|
|
|
|
async toggleCustomScoring(leagueId: string, enabled: boolean): Promise<Result<void, DomainError>> {
|
|
return Result.err({ type: 'notImplemented', message: 'toggleCustomScoring' });
|
|
}
|
|
|
|
getPresetEmoji(preset: string): string {
|
|
return '🏆';
|
|
}
|
|
|
|
getPresetDescription(preset: string): string {
|
|
return `Scoring preset: ${preset}`;
|
|
}
|
|
} |