This commit is contained in:
2025-12-11 13:50:38 +01:00
parent e4c1be628d
commit c7e5de40d6
212 changed files with 2965 additions and 763 deletions

View File

@@ -2,8 +2,17 @@ import { RaceTimeOfDay } from './RaceTimeOfDay';
import { LeagueTimezone } from './LeagueTimezone';
import type { RecurrenceStrategy } from './RecurrenceStrategy';
import { RacingDomainValidationError } from '../errors/RacingDomainError';
import type { IValueObject } from '@gridpilot/shared/domain';
export class SeasonSchedule {
export interface SeasonScheduleProps {
startDate: Date;
timeOfDay: RaceTimeOfDay;
timezone: LeagueTimezone;
recurrence: RecurrenceStrategy;
plannedRounds: number;
}
export class SeasonSchedule implements IValueObject<SeasonScheduleProps> {
readonly startDate: Date;
readonly timeOfDay: RaceTimeOfDay;
readonly timezone: LeagueTimezone;
@@ -34,4 +43,26 @@ export class SeasonSchedule {
this.recurrence = params.recurrence;
this.plannedRounds = params.plannedRounds;
}
get props(): SeasonScheduleProps {
return {
startDate: this.startDate,
timeOfDay: this.timeOfDay,
timezone: this.timezone,
recurrence: this.recurrence,
plannedRounds: this.plannedRounds,
};
}
equals(other: IValueObject<SeasonScheduleProps>): boolean {
const a = this.props;
const b = other.props;
return (
a.startDate.getTime() === b.startDate.getTime() &&
a.timeOfDay.equals(b.timeOfDay) &&
a.timezone.equals(b.timezone) &&
a.recurrence.kind === b.recurrence.kind &&
a.plannedRounds === b.plannedRounds
);
}
}