This commit is contained in:
2025-12-07 00:18:02 +01:00
parent 70d5f5689e
commit 5ca2454853
20 changed files with 4461 additions and 790 deletions

View File

@@ -1,5 +1,17 @@
import type { LeagueVisibilityType } from '../../domain/value-objects/LeagueVisibility';
export type LeagueStructureMode = 'solo' | 'fixedTeams';
/**
* League visibility determines public visibility and ranking status.
* - 'ranked': Public, competitive, affects driver ratings. Requires min 10 drivers.
* - 'unranked': Private, casual with friends. No rating impact. Any number of drivers.
*
* For backward compatibility, 'public'/'private' are also supported in the form,
* but the domain uses 'ranked'/'unranked'.
*/
export type LeagueVisibilityFormValue = LeagueVisibilityType | 'public' | 'private';
export interface LeagueStructureFormDTO {
mode: LeagueStructureMode;
maxDrivers: number;
@@ -50,12 +62,40 @@ export interface LeagueConfigFormModel {
basics: {
name: string;
description?: string;
visibility: 'public' | 'private';
/**
* League visibility/ranking mode.
* - 'ranked' (or legacy 'public'): Competitive, public, affects ratings. Min 10 drivers.
* - 'unranked' (or legacy 'private'): Casual with friends, no rating impact.
*/
visibility: LeagueVisibilityFormValue;
gameId: string;
/**
* League logo as base64 data URL (optional).
* Format: data:image/png;base64,... or data:image/jpeg;base64,...
*/
logoDataUrl?: string;
};
structure: LeagueStructureFormDTO;
championships: LeagueChampionshipsFormDTO;
scoring: LeagueScoringFormDTO;
dropPolicy: LeagueDropPolicyFormDTO;
timings: LeagueTimingsFormDTO;
}
/**
* Helper to normalize visibility values to new terminology.
* Maps 'public' -> 'ranked' and 'private' -> 'unranked'.
*/
export function normalizeVisibility(value: LeagueVisibilityFormValue): LeagueVisibilityType {
if (value === 'public' || value === 'ranked') return 'ranked';
return 'unranked';
}
/**
* Helper to convert new terminology to legacy for backward compatibility.
* Maps 'ranked' -> 'public' and 'unranked' -> 'private'.
*/
export function toLegacyVisibility(value: LeagueVisibilityFormValue): 'public' | 'private' {
if (value === 'ranked' || value === 'public') return 'public';
return 'private';
}