This commit is contained in:
2025-12-17 00:33:13 +01:00
parent 8c67081953
commit f01e01e50c
186 changed files with 9242 additions and 1342 deletions

View File

@@ -8,7 +8,7 @@
import { RacingDomainValidationError, RacingDomainInvariantError } from '../errors/RacingDomainError';
import type { IEntity } from '@core/shared/domain';
import type { Session } from './Session';
import type { SessionType } from '../value-objects/SessionType';
import { SessionType } from '../value-objects/SessionType';
export type RaceEventStatus = 'scheduled' | 'in_progress' | 'awaiting_stewarding' | 'closed' | 'cancelled';
@@ -127,9 +127,9 @@ export class RaceEvent implements IEntity<string> {
seasonId: this.seasonId,
leagueId: this.leagueId,
name: this.name,
sessions: this.sessions,
sessions: [...this.sessions],
status: 'in_progress',
stewardingClosesAt: this.stewardingClosesAt,
...(this.stewardingClosesAt !== undefined ? { stewardingClosesAt: this.stewardingClosesAt } : {}),
});
}
@@ -151,9 +151,9 @@ export class RaceEvent implements IEntity<string> {
seasonId: this.seasonId,
leagueId: this.leagueId,
name: this.name,
sessions: this.sessions,
sessions: [...this.sessions],
status: 'awaiting_stewarding',
stewardingClosesAt: this.stewardingClosesAt,
...(this.stewardingClosesAt !== undefined ? { stewardingClosesAt: this.stewardingClosesAt } : {}),
});
}
@@ -170,9 +170,9 @@ export class RaceEvent implements IEntity<string> {
seasonId: this.seasonId,
leagueId: this.leagueId,
name: this.name,
sessions: this.sessions,
sessions: [...this.sessions],
status: 'closed',
stewardingClosesAt: this.stewardingClosesAt,
...(this.stewardingClosesAt !== undefined ? { stewardingClosesAt: this.stewardingClosesAt } : {}),
});
}
@@ -193,9 +193,9 @@ export class RaceEvent implements IEntity<string> {
seasonId: this.seasonId,
leagueId: this.leagueId,
name: this.name,
sessions: this.sessions,
sessions: [...this.sessions],
status: 'cancelled',
stewardingClosesAt: this.stewardingClosesAt,
...(this.stewardingClosesAt !== undefined ? { stewardingClosesAt: this.stewardingClosesAt } : {}),
});
}
@@ -232,7 +232,7 @@ export class RaceEvent implements IEntity<string> {
*/
isMainRaceCompleted(): boolean {
const mainRace = this.getMainRaceSession();
return mainRace?.status === 'completed' ?? false;
return mainRace ? mainRace.status === 'completed' : false;
}
/**