This commit is contained in:
2025-12-12 01:11:36 +01:00
parent ec3ddc3a5c
commit 6a88fe93ab
125 changed files with 1513 additions and 803 deletions

View File

@@ -20,7 +20,7 @@ export class Track implements IEntity<string> {
readonly difficulty: TrackDifficulty;
readonly lengthKm: number;
readonly turns: number;
readonly imageUrl?: string;
readonly imageUrl: string | undefined;
readonly gameId: string;
private constructor(props: {
@@ -32,7 +32,7 @@ export class Track implements IEntity<string> {
difficulty: TrackDifficulty;
lengthKm: number;
turns: number;
imageUrl?: string;
imageUrl?: string | undefined;
gameId: string;
}) {
this.id = props.id;
@@ -64,7 +64,7 @@ export class Track implements IEntity<string> {
}): Track {
this.validate(props);
return new Track({
const base = {
id: props.id,
name: props.name,
shortName: props.shortName ?? props.name.slice(0, 3).toUpperCase(),
@@ -73,9 +73,13 @@ export class Track implements IEntity<string> {
difficulty: props.difficulty ?? 'intermediate',
lengthKm: props.lengthKm,
turns: props.turns,
imageUrl: props.imageUrl,
gameId: props.gameId,
});
};
const withImage =
props.imageUrl !== undefined ? { ...base, imageUrl: props.imageUrl } : base;
return new Track(withImage);
}
/**