racing typeorm
This commit is contained in:
@@ -252,6 +252,47 @@ export class League implements IEntity<LeagueId> {
|
||||
});
|
||||
}
|
||||
|
||||
static rehydrate(props: {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
ownerId: string;
|
||||
settings: LeagueSettings;
|
||||
createdAt: Date;
|
||||
participantCount: number;
|
||||
socialLinks?: {
|
||||
discordUrl?: string;
|
||||
youtubeUrl?: string;
|
||||
websiteUrl?: string;
|
||||
};
|
||||
}): League {
|
||||
const id = LeagueId.create(props.id);
|
||||
const name = LeagueName.create(props.name);
|
||||
const description = LeagueDescription.create(props.description);
|
||||
const ownerId = LeagueOwnerId.create(props.ownerId);
|
||||
const createdAt = LeagueCreatedAt.create(props.createdAt);
|
||||
|
||||
const visibilityType = props.settings.visibility ?? 'ranked';
|
||||
const visibility = LeagueVisibility.fromString(visibilityType);
|
||||
|
||||
const participantCount = ParticipantCount.create(props.participantCount);
|
||||
const socialLinks = props.socialLinks
|
||||
? LeagueSocialLinks.create(props.socialLinks)
|
||||
: undefined;
|
||||
|
||||
return new League({
|
||||
id,
|
||||
name,
|
||||
description,
|
||||
ownerId,
|
||||
settings: props.settings,
|
||||
createdAt,
|
||||
...(socialLinks !== undefined ? { socialLinks } : {}),
|
||||
participantCount,
|
||||
visibility,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate stewarding settings configuration
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user