inmemory to postgres

This commit is contained in:
2025-12-29 18:34:12 +01:00
parent 9e17d0752a
commit f5639a367f
176 changed files with 10175 additions and 468 deletions

View File

@@ -73,6 +73,34 @@ export class Team implements IEntity<string> {
});
}
static rehydrate(props: {
id: string;
name: string;
tag: string;
description: string;
ownerId: string;
leagues: string[];
createdAt: Date;
}): Team {
if (!props.id || props.id.trim().length === 0) {
throw new RacingDomainValidationError('Team ID is required');
}
if (!Array.isArray(props.leagues)) {
throw new RacingDomainValidationError('Team leagues must be an array');
}
return new Team({
id: props.id,
name: TeamName.create(props.name),
tag: TeamTag.create(props.tag),
description: TeamDescription.create(props.description),
ownerId: DriverId.create(props.ownerId),
leagues: props.leagues.map(leagueId => LeagueId.create(leagueId)),
createdAt: TeamCreatedAt.create(props.createdAt),
});
}
/**
* Create a copy with updated properties.
*/