This commit is contained in:
2025-12-17 01:23:09 +01:00
parent f01e01e50c
commit 4d890863d3
73 changed files with 2632 additions and 3224 deletions

View File

@@ -1,8 +1,13 @@
import { RacingDomainValidationError } from '../errors/RacingDomainError';
import type { IValueObject } from '@core/shared/domain';
export class TrackTurns {
export class TrackTurns implements IValueObject<number> {
private constructor(private readonly value: number) {}
get props(): number {
return this.value;
}
static create(value: number): TrackTurns {
if (value < 0) {
throw new RacingDomainValidationError('Track turns cannot be negative');
@@ -14,7 +19,7 @@ export class TrackTurns {
return this.value;
}
equals(other: TrackTurns): boolean {
return this.value === other.value;
equals(other: IValueObject<number>): boolean {
return this.value === other.props;
}
}