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

@@ -3,8 +3,9 @@
*
* Represents a valid league name with validation rules.
*/
import { RacingDomainValidationError } from '../errors/RacingDomainError';
import type { IValueObject } from '@gridpilot/shared/domain';
export interface LeagueNameValidationResult {
valid: boolean;
@@ -22,7 +23,11 @@ export const LEAGUE_NAME_CONSTRAINTS = {
],
} as const;
export class LeagueName {
export interface LeagueNameProps {
value: string;
}
export class LeagueName implements IValueObject<LeagueNameProps> {
readonly value: string;
private constructor(value: string) {
@@ -83,6 +88,10 @@ export class LeagueName {
return new LeagueName(value.trim());
}
get props(): LeagueNameProps {
return { value: this.value };
}
/**
* Try to create a LeagueName, returning null if invalid
*/
@@ -97,8 +106,8 @@ export class LeagueName {
toString(): string {
return this.value;
}
equals(other: LeagueName): boolean {
return this.value === other.value;
equals(other: IValueObject<LeagueNameProps>): boolean {
return this.props.value === other.props.value;
}
}