refactor
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
|
||||
export class TrackGameId {
|
||||
export class TrackGameId implements IValueObject<string> {
|
||||
private constructor(private readonly value: string) {}
|
||||
|
||||
get props(): string {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
static create(value: string): TrackGameId {
|
||||
if (!value || value.trim().length === 0) {
|
||||
throw new RacingDomainValidationError('Track game ID cannot be empty');
|
||||
@@ -14,7 +19,7 @@ export class TrackGameId {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
equals(other: TrackGameId): boolean {
|
||||
return this.value === other.value;
|
||||
equals(other: IValueObject<string>): boolean {
|
||||
return this.value === other.props;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user