seed data

This commit is contained in:
2025-12-30 18:33:15 +01:00
parent 83371ea839
commit 92226800df
306 changed files with 1753 additions and 501 deletions

View File

@@ -22,6 +22,8 @@ export class Team implements IEntity<string> {
readonly description: TeamDescription;
readonly ownerId: DriverId;
readonly leagues: LeagueId[];
readonly category: string | undefined;
readonly isRecruiting: boolean;
readonly createdAt: TeamCreatedAt;
private constructor(props: {
@@ -31,6 +33,8 @@ export class Team implements IEntity<string> {
description: TeamDescription;
ownerId: DriverId;
leagues: LeagueId[];
category: string | undefined;
isRecruiting: boolean;
createdAt: TeamCreatedAt;
}) {
this.id = props.id;
@@ -39,6 +43,8 @@ export class Team implements IEntity<string> {
this.description = props.description;
this.ownerId = props.ownerId;
this.leagues = props.leagues;
this.category = props.category;
this.isRecruiting = props.isRecruiting;
this.createdAt = props.createdAt;
}
@@ -52,6 +58,8 @@ export class Team implements IEntity<string> {
description: string;
ownerId: string;
leagues: string[];
category?: string;
isRecruiting?: boolean;
createdAt?: Date;
}): Team {
if (!props.id || props.id.trim().length === 0) {
@@ -69,6 +77,8 @@ export class Team implements IEntity<string> {
description: TeamDescription.create(props.description),
ownerId: DriverId.create(props.ownerId),
leagues: props.leagues.map(leagueId => LeagueId.create(leagueId)),
category: props.category,
isRecruiting: props.isRecruiting ?? false,
createdAt: TeamCreatedAt.create(props.createdAt ?? new Date()),
});
}
@@ -80,6 +90,8 @@ export class Team implements IEntity<string> {
description: string;
ownerId: string;
leagues: string[];
category?: string;
isRecruiting: boolean;
createdAt: Date;
}): Team {
if (!props.id || props.id.trim().length === 0) {
@@ -97,6 +109,8 @@ export class Team implements IEntity<string> {
description: TeamDescription.create(props.description),
ownerId: DriverId.create(props.ownerId),
leagues: props.leagues.map(leagueId => LeagueId.create(leagueId)),
category: props.category,
isRecruiting: props.isRecruiting,
createdAt: TeamCreatedAt.create(props.createdAt),
});
}
@@ -110,12 +124,16 @@ export class Team implements IEntity<string> {
description: string;
ownerId: string;
leagues: string[];
category: string | undefined;
isRecruiting: boolean;
}>): Team {
const nextName = 'name' in props ? TeamName.create(props.name!) : this.name;
const nextTag = 'tag' in props ? TeamTag.create(props.tag!) : this.tag;
const nextDescription = 'description' in props ? TeamDescription.create(props.description!) : this.description;
const nextOwnerId = 'ownerId' in props ? DriverId.create(props.ownerId!) : this.ownerId;
const nextLeagues = 'leagues' in props ? props.leagues!.map(leagueId => LeagueId.create(leagueId)) : this.leagues;
const nextCategory = 'category' in props ? props.category : this.category;
const nextIsRecruiting = 'isRecruiting' in props ? props.isRecruiting! : this.isRecruiting;
return new Team({
id: this.id,
@@ -124,6 +142,8 @@ export class Team implements IEntity<string> {
description: nextDescription,
ownerId: nextOwnerId,
leagues: nextLeagues,
category: nextCategory,
isRecruiting: nextIsRecruiting,
createdAt: this.createdAt,
});
}