wip
This commit is contained in:
@@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user