refactor
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
|
||||
export class TrackImageUrl {
|
||||
export class TrackImageUrl implements IValueObject<string | undefined> {
|
||||
private constructor(private readonly value: string | undefined) {}
|
||||
|
||||
get props(): string | undefined {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
static create(value: string | undefined): TrackImageUrl {
|
||||
// Allow undefined or valid URL, but for simplicity, just check if string is not empty if provided
|
||||
if (value !== undefined && value.trim().length === 0) {
|
||||
@@ -15,7 +20,7 @@ export class TrackImageUrl {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
equals(other: TrackImageUrl): boolean {
|
||||
return this.value === other.value;
|
||||
equals(other: IValueObject<string | undefined>): boolean {
|
||||
return this.value === other.props;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user