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 TeamCreatedAt {
export class TeamCreatedAt implements IValueObject<Date> {
private constructor(private readonly value: Date) {}
get props(): Date {
return new Date(this.value);
}
static create(value: Date): TeamCreatedAt {
const now = new Date();
if (value > now) {
@@ -15,7 +20,7 @@ export class TeamCreatedAt {
return new Date(this.value);
}
equals(other: TeamCreatedAt): boolean {
return this.value.getTime() === other.value.getTime();
equals(other: IValueObject<Date>): boolean {
return this.value.getTime() === other.props.getTime();
}
}