inmemory to postgres
This commit is contained in:
@@ -70,6 +70,24 @@ export class LeagueMembership implements IEntity<string> {
|
||||
});
|
||||
}
|
||||
|
||||
static rehydrate(props: {
|
||||
id: string;
|
||||
leagueId: string;
|
||||
driverId: string;
|
||||
role: MembershipRoleValue;
|
||||
status: MembershipStatusValue;
|
||||
joinedAt: Date;
|
||||
}): LeagueMembership {
|
||||
return new LeagueMembership({
|
||||
id: props.id,
|
||||
leagueId: LeagueId.create(props.leagueId),
|
||||
driverId: DriverId.create(props.driverId),
|
||||
role: MembershipRole.create(props.role),
|
||||
status: MembershipStatus.create(props.status),
|
||||
joinedAt: JoinedAt.create(props.joinedAt),
|
||||
});
|
||||
}
|
||||
|
||||
private static validate(props: LeagueMembershipProps): void {
|
||||
if (!props.leagueId || props.leagueId.trim().length === 0) {
|
||||
throw new RacingDomainValidationError('League ID is required');
|
||||
|
||||
Reference in New Issue
Block a user