website refactor
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* Immutable entity with factory methods and domain validation.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { CarClass, CarClassType } from './CarClass';
|
||||
import { CarId } from './CarId';
|
||||
@@ -18,8 +18,7 @@ import { Manufacturer } from './Manufacturer';
|
||||
import { Weight } from './Weight';
|
||||
import { Year } from './Year';
|
||||
|
||||
export class Car implements Entity<CarId> {
|
||||
readonly id: CarId;
|
||||
export class Car extends Entity<CarId> {
|
||||
readonly name: CarName;
|
||||
readonly shortName: string;
|
||||
readonly manufacturer: Manufacturer;
|
||||
@@ -44,7 +43,8 @@ export class Car implements Entity<CarId> {
|
||||
imageUrl?: ImageUrl;
|
||||
gameId: GameId;
|
||||
}) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.name = props.name;
|
||||
this.shortName = props.shortName;
|
||||
this.manufacturer = props.manufacturer;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
import { MediaReference } from '@core/domain/media/MediaReference';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { CountryCode } from '../value-objects/CountryCode';
|
||||
import { DriverBio } from '../value-objects/driver/DriverBio';
|
||||
@@ -14,8 +14,7 @@ import { DriverName } from '../value-objects/driver/DriverName';
|
||||
import { JoinedAt } from '../value-objects/JoinedAt';
|
||||
import { IRacingId } from '../value-objects/RacingId';
|
||||
|
||||
export class Driver implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class Driver extends Entity<string> {
|
||||
readonly iracingId: IRacingId;
|
||||
readonly name: DriverName;
|
||||
readonly country: CountryCode;
|
||||
@@ -34,7 +33,8 @@ export class Driver implements Entity<string> {
|
||||
category?: string;
|
||||
avatarRef: MediaReference;
|
||||
}) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.iracingId = props.iracingId;
|
||||
this.name = props.name;
|
||||
this.country = props.country;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Includes user-placed decals and league-specific overrides.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { CarId } from '../value-objects/CarId';
|
||||
@@ -28,8 +28,7 @@ export interface DriverLiveryProps {
|
||||
validatedAt: Date | undefined;
|
||||
}
|
||||
|
||||
export class DriverLivery implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class DriverLivery extends Entity<string> {
|
||||
readonly driverId: DriverId;
|
||||
readonly gameId: GameId;
|
||||
readonly carId: CarId;
|
||||
@@ -41,7 +40,8 @@ export class DriverLivery implements Entity<string> {
|
||||
readonly validatedAt: Date | undefined;
|
||||
|
||||
private constructor(props: DriverLiveryProps) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.driverId = props.driverId;
|
||||
this.gameId = props.gameId;
|
||||
this.carId = props.carId;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { GameId } from './GameId';
|
||||
import { GameName } from './GameName';
|
||||
|
||||
export class Game implements Entity<GameId> {
|
||||
readonly id: GameId;
|
||||
export class Game extends Entity<GameId> {
|
||||
readonly name: GameName;
|
||||
|
||||
private constructor(props: { id: GameId; name: GameName }) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.name = props.name;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Represents a request to join a league.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { JoinedAt } from '../value-objects/JoinedAt';
|
||||
import { LeagueId } from './LeagueId';
|
||||
@@ -18,15 +18,15 @@ export interface JoinRequestProps {
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export class JoinRequest implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class JoinRequest extends Entity<string> {
|
||||
readonly leagueId: LeagueId;
|
||||
readonly driverId: LeagueOwnerId;
|
||||
readonly requestedAt: JoinedAt;
|
||||
readonly message: string | undefined;
|
||||
|
||||
private constructor(props: { id: string; leagueId: string; driverId: string; requestedAt: Date; message?: string }) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.leagueId = LeagueId.create(props.leagueId);
|
||||
this.driverId = LeagueOwnerId.create(props.driverId);
|
||||
this.requestedAt = JoinedAt.create(props.requestedAt);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
import { MediaReference } from '@core/domain/media/MediaReference';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { LeagueVisibility, LeagueVisibilityType } from '../value-objects/LeagueVisibility';
|
||||
import { MaxParticipants } from '../value-objects/MaxParticipants';
|
||||
@@ -91,8 +91,7 @@ export interface LeagueSettings {
|
||||
visibility?: LeagueVisibilityType;
|
||||
}
|
||||
|
||||
export class League implements Entity<LeagueId> {
|
||||
readonly id: LeagueId;
|
||||
export class League extends Entity<LeagueId> {
|
||||
readonly name: LeagueName;
|
||||
readonly description: LeagueDescription;
|
||||
readonly ownerId: LeagueOwnerId;
|
||||
@@ -119,7 +118,8 @@ export class League implements Entity<LeagueId> {
|
||||
visibility: LeagueVisibility;
|
||||
logoRef: MediaReference;
|
||||
}) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.name = props.name;
|
||||
this.description = props.description;
|
||||
this.ownerId = props.ownerId;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Represents a driver's membership in a league.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { JoinedAt } from '../value-objects/JoinedAt';
|
||||
import { DriverId } from './DriverId';
|
||||
@@ -22,8 +22,7 @@ export interface LeagueMembershipProps {
|
||||
joinedAt?: Date;
|
||||
}
|
||||
|
||||
export class LeagueMembership implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class LeagueMembership extends Entity<string> {
|
||||
readonly leagueId: LeagueId;
|
||||
readonly driverId: DriverId;
|
||||
readonly role: MembershipRole;
|
||||
@@ -38,7 +37,8 @@ export class LeagueMembership implements Entity<string> {
|
||||
status: MembershipStatus;
|
||||
joinedAt: JoinedAt;
|
||||
}) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.leagueId = props.leagueId;
|
||||
this.driverId = props.driverId;
|
||||
this.role = props.role;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Represents the scoring configuration for a league season.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { ChampionshipConfig } from '../types/ChampionshipConfig';
|
||||
import { LeagueScoringConfigId } from './LeagueScoringConfigId';
|
||||
@@ -25,8 +25,7 @@ export interface LeagueScoringConfigRehydrateProps {
|
||||
championships: ChampionshipConfig[];
|
||||
}
|
||||
|
||||
export class LeagueScoringConfig implements Entity<LeagueScoringConfigId> {
|
||||
readonly id: LeagueScoringConfigId;
|
||||
export class LeagueScoringConfig extends Entity<LeagueScoringConfigId> {
|
||||
readonly seasonId: SeasonId;
|
||||
readonly scoringPresetId: ScoringPresetId | undefined;
|
||||
readonly championships: ChampionshipConfig[];
|
||||
@@ -37,7 +36,8 @@ export class LeagueScoringConfig implements Entity<LeagueScoringConfigId> {
|
||||
scoringPresetId?: ScoringPresetId;
|
||||
championships: ChampionshipConfig[];
|
||||
}) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.seasonId = props.seasonId;
|
||||
this.scoringPresetId = props.scoringPresetId;
|
||||
this.championships = props.championships;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Contains base image and sponsor decal placements.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { CarId } from '../value-objects/CarId';
|
||||
import type { LiveryDecal } from '../value-objects/LiveryDecal';
|
||||
@@ -16,8 +16,7 @@ import { LiveryTemplateId } from './LiveryTemplateId';
|
||||
import { LiveryTemplateUpdatedAt } from './LiveryTemplateUpdatedAt';
|
||||
import { SeasonId } from './season/SeasonId';
|
||||
|
||||
export class LiveryTemplate implements Entity<LiveryTemplateId> {
|
||||
readonly id: LiveryTemplateId;
|
||||
export class LiveryTemplate extends Entity<LiveryTemplateId> {
|
||||
readonly leagueId: LeagueId;
|
||||
readonly seasonId: SeasonId;
|
||||
readonly carId: CarId;
|
||||
@@ -36,7 +35,8 @@ export class LiveryTemplate implements Entity<LiveryTemplateId> {
|
||||
createdAt: LiveryTemplateCreatedAt;
|
||||
updatedAt?: LiveryTemplateUpdatedAt;
|
||||
}) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.leagueId = props.leagueId;
|
||||
this.seasonId = props.seasonId;
|
||||
this.carId = props.carId;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* - dismissed: Protest was dismissed (no action taken)
|
||||
* - withdrawn: Protesting driver withdrew the protest
|
||||
*/
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { DecisionNotes } from './DecisionNotes';
|
||||
import { DefenseRequestedAt } from './DefenseRequestedAt';
|
||||
@@ -58,8 +58,9 @@ export interface ProtestProps {
|
||||
defenseRequestedBy?: StewardId;
|
||||
}
|
||||
|
||||
export class Protest implements Entity<string> {
|
||||
private constructor(private readonly props: ProtestProps) {}
|
||||
export class Protest extends Entity<string> {
|
||||
private constructor(private readonly props: ProtestProps) {
|
||||
super(props.id);}
|
||||
|
||||
static create(props: {
|
||||
id: string;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Immutable entity with factory methods and domain validation.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { MaxParticipants } from '../value-objects/MaxParticipants';
|
||||
import { ParticipantCount } from '../value-objects/ParticipantCount';
|
||||
@@ -15,8 +15,7 @@ import { StrengthOfField } from '../value-objects/StrengthOfField';
|
||||
|
||||
export type { RaceStatus, RaceStatusValue } from '../value-objects/RaceStatus';
|
||||
|
||||
export class Race implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class Race extends Entity<string> {
|
||||
readonly leagueId: string;
|
||||
readonly scheduledAt: Date;
|
||||
readonly track: string;
|
||||
@@ -60,7 +59,8 @@ export class Race implements Entity<string> {
|
||||
registeredCount?: ParticipantCount;
|
||||
maxParticipants?: MaxParticipants;
|
||||
}) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.leagueId = props.leagueId;
|
||||
this.scheduledAt = props.scheduledAt;
|
||||
this.track = props.track;
|
||||
|
||||
@@ -5,15 +5,14 @@
|
||||
* Immutable aggregate root with factory methods and domain validation.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { SessionType } from '../value-objects/SessionType';
|
||||
import type { Session } from './Session';
|
||||
|
||||
export type RaceEventStatus = 'scheduled' | 'in_progress' | 'awaiting_stewarding' | 'closed' | 'cancelled';
|
||||
|
||||
export class RaceEvent implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class RaceEvent extends Entity<string> {
|
||||
readonly seasonId: string;
|
||||
readonly leagueId: string;
|
||||
readonly name: string;
|
||||
@@ -30,7 +29,8 @@ export class RaceEvent implements Entity<string> {
|
||||
status: RaceEventStatus;
|
||||
stewardingClosesAt?: Date;
|
||||
}) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.seasonId = props.seasonId;
|
||||
this.leagueId = props.leagueId;
|
||||
this.name = props.name;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Represents a registration of a driver for a specific race.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { DriverId } from './DriverId';
|
||||
import { RaceId } from './RaceId';
|
||||
@@ -17,9 +17,8 @@ export interface RaceRegistrationProps {
|
||||
registeredAt?: Date;
|
||||
}
|
||||
|
||||
export class RaceRegistration implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly raceId: RaceId;
|
||||
export class RaceRegistration extends Entity<string> {
|
||||
readonly raceId: RaceId;
|
||||
readonly driverId: DriverId;
|
||||
readonly registeredAt: RegisteredAt;
|
||||
|
||||
@@ -29,7 +28,8 @@ export class RaceRegistration implements Entity<string> {
|
||||
driverId: DriverId;
|
||||
registeredAt: RegisteredAt;
|
||||
}) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.raceId = props.raceId;
|
||||
this.driverId = props.driverId;
|
||||
this.registeredAt = props.registeredAt;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Enhanced Result entity with detailed incident tracking
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { RaceIncidents, type IncidentRecord } from '../value-objects/RaceIncidents';
|
||||
import { DriverId } from './DriverId';
|
||||
@@ -10,8 +10,7 @@ import { RaceId } from './RaceId';
|
||||
import { LapTime } from './result/LapTime';
|
||||
import { Position } from './result/Position';
|
||||
|
||||
export class ResultWithIncidents implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class ResultWithIncidents extends Entity<string> {
|
||||
readonly raceId: RaceId;
|
||||
readonly driverId: DriverId;
|
||||
readonly position: Position;
|
||||
@@ -28,7 +27,8 @@ export class ResultWithIncidents implements Entity<string> {
|
||||
incidents: RaceIncidents;
|
||||
startPosition: Position;
|
||||
}) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.raceId = props.raceId;
|
||||
this.driverId = props.driverId;
|
||||
this.position = props.position;
|
||||
|
||||
@@ -5,14 +5,13 @@
|
||||
* Immutable entity with factory methods and domain validation.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { SessionType } from '../value-objects/SessionType';
|
||||
|
||||
export type SessionStatus = 'scheduled' | 'running' | 'completed' | 'cancelled';
|
||||
|
||||
export class Session implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class Session extends Entity<string> {
|
||||
readonly raceEventId: string;
|
||||
readonly scheduledAt: Date;
|
||||
readonly track: string;
|
||||
@@ -39,7 +38,8 @@ export class Session implements Entity<string> {
|
||||
registeredCount?: number;
|
||||
maxParticipants?: number;
|
||||
}) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.raceEventId = props.raceEventId;
|
||||
this.scheduledAt = props.scheduledAt;
|
||||
this.track = props.track;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* (driver, team, race, or league/season). The entity owner must approve/reject.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
|
||||
import type { Money } from '../value-objects/Money';
|
||||
@@ -29,8 +29,7 @@ export interface SponsorshipRequestProps {
|
||||
rejectionReason?: string;
|
||||
}
|
||||
|
||||
export class SponsorshipRequest implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class SponsorshipRequest extends Entity<string> {
|
||||
readonly sponsorId: string;
|
||||
readonly entityType: SponsorableEntityType;
|
||||
readonly entityId: string;
|
||||
@@ -44,7 +43,8 @@ export class SponsorshipRequest implements Entity<string> {
|
||||
readonly rejectionReason: string | undefined;
|
||||
|
||||
private constructor(props: SponsorshipRequestProps) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.sponsorId = props.sponsorId;
|
||||
this.entityType = props.entityType;
|
||||
this.entityId = props.entityId;
|
||||
|
||||
@@ -6,15 +6,14 @@
|
||||
*/
|
||||
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { Points } from '../value-objects/Points';
|
||||
import { Position } from './championship/Position';
|
||||
import { DriverId } from './DriverId';
|
||||
import { LeagueId } from './LeagueId';
|
||||
|
||||
export class Standing implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class Standing extends Entity<string> {
|
||||
readonly leagueId: LeagueId;
|
||||
readonly driverId: DriverId;
|
||||
readonly points: Points;
|
||||
@@ -31,7 +30,8 @@ export class Standing implements Entity<string> {
|
||||
position: Position;
|
||||
racesCompleted: number;
|
||||
}) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.leagueId = props.leagueId;
|
||||
this.driverId = props.driverId;
|
||||
this.points = props.points;
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
* Domain Entity: Team
|
||||
*
|
||||
* Represents a racing team in the GridPilot platform.
|
||||
* Implements the shared IEntity<string> contract and encapsulates
|
||||
* Implements the shared Entity<string> contract and encapsulates
|
||||
* basic invariants around identity and core properties.
|
||||
*/
|
||||
|
||||
import { MediaReference } from '@core/domain/media/MediaReference';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { TeamCreatedAt } from '../value-objects/TeamCreatedAt';
|
||||
import { TeamDescription } from '../value-objects/TeamDescription';
|
||||
@@ -16,8 +16,7 @@ import { TeamTag } from '../value-objects/TeamTag';
|
||||
import { DriverId } from './DriverId';
|
||||
import { LeagueId } from './LeagueId';
|
||||
|
||||
export class Team implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class Team extends Entity<string> {
|
||||
readonly name: TeamName;
|
||||
readonly tag: TeamTag;
|
||||
readonly description: TeamDescription;
|
||||
@@ -40,7 +39,8 @@ export class Team implements Entity<string> {
|
||||
createdAt: TeamCreatedAt;
|
||||
logoRef: MediaReference;
|
||||
}) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.name = props.name;
|
||||
this.tag = props.tag;
|
||||
this.description = props.description;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Entity, IEntity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { TeamRatingDelta } from '../value-objects/TeamRatingDelta';
|
||||
import { TeamRatingDimensionKey } from '../value-objects/TeamRatingDimensionKey';
|
||||
@@ -32,8 +32,7 @@ export interface TeamRatingEventProps {
|
||||
version: number;
|
||||
}
|
||||
|
||||
export class TeamRatingEvent implements Entity<TeamRatingEventId> {
|
||||
readonly id: TeamRatingEventId;
|
||||
export class TeamRatingEvent extends Entity<TeamRatingEventId> {
|
||||
readonly teamId: string;
|
||||
readonly dimension: TeamRatingDimensionKey;
|
||||
readonly delta: TeamRatingDelta;
|
||||
@@ -46,7 +45,8 @@ export class TeamRatingEvent implements Entity<TeamRatingEventId> {
|
||||
readonly version: number;
|
||||
|
||||
private constructor(props: TeamRatingEventProps) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.teamId = props.teamId;
|
||||
this.dimension = props.dimension;
|
||||
this.delta = props.delta;
|
||||
@@ -156,7 +156,7 @@ export class TeamRatingEvent implements Entity<TeamRatingEventId> {
|
||||
/**
|
||||
* Compare with another event.
|
||||
*/
|
||||
equals(other: IEntity<TeamRatingEventId>): boolean {
|
||||
equals(other: Entity<TeamRatingEventId>): boolean {
|
||||
return this.id.equals(other.id);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Immutable entity with factory methods and domain validation.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { TrackCountry } from '../value-objects/TrackCountry';
|
||||
import { TrackGameId } from '../value-objects/TrackGameId';
|
||||
@@ -18,8 +18,7 @@ import { TrackTurns } from '../value-objects/TrackTurns';
|
||||
export type TrackCategory = 'oval' | 'road' | 'street' | 'dirt';
|
||||
export type TrackDifficulty = 'beginner' | 'intermediate' | 'advanced' | 'expert';
|
||||
|
||||
export class Track implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class Track extends Entity<string> {
|
||||
readonly name: TrackName;
|
||||
readonly shortName: TrackShortName;
|
||||
readonly country: TrackCountry;
|
||||
@@ -42,7 +41,8 @@ export class Track implements Entity<string> {
|
||||
imageUrl: TrackImageUrl;
|
||||
gameId: TrackGameId;
|
||||
}) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.name = props.name;
|
||||
this.shortName = props.shortName;
|
||||
this.country = props.country;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../../errors/RacingDomainError';
|
||||
import type { ParticipantRef } from '../../types/ParticipantRef';
|
||||
import { Points } from '../../value-objects/Points';
|
||||
import { Position } from './Position';
|
||||
import { ResultsCount } from './ResultsCount';
|
||||
|
||||
export class ChampionshipStanding implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class ChampionshipStanding extends Entity<string> {
|
||||
readonly seasonId: string;
|
||||
readonly championshipId: string;
|
||||
readonly participant: ParticipantRef;
|
||||
@@ -24,6 +23,7 @@ export class ChampionshipStanding implements Entity<string> {
|
||||
resultsDropped: number;
|
||||
position: number;
|
||||
}) {
|
||||
super(props.id);
|
||||
this.seasonId = props.seasonId;
|
||||
this.championshipId = props.championshipId;
|
||||
this.participant = props.participant;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Aggregate root for managing league finances and transactions.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../../errors/RacingDomainError';
|
||||
|
||||
import type { Money } from '../../value-objects/Money';
|
||||
@@ -21,15 +21,15 @@ export interface LeagueWalletProps {
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
export class LeagueWallet implements Entity<LeagueWalletId> {
|
||||
readonly id: LeagueWalletId;
|
||||
export class LeagueWallet extends Entity<LeagueWalletId> {
|
||||
readonly leagueId: LeagueId;
|
||||
readonly balance: Money;
|
||||
readonly transactionIds: TransactionId[];
|
||||
readonly createdAt: Date;
|
||||
|
||||
private constructor(props: LeagueWalletProps) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.leagueId = props.leagueId;
|
||||
this.balance = props.balance;
|
||||
this.transactionIds = props.transactionIds;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../../errors/RacingDomainError';
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import type { Money } from '../../value-objects/Money';
|
||||
import { LeagueWalletId } from './LeagueWalletId';
|
||||
import { TransactionId } from './TransactionId';
|
||||
@@ -34,8 +34,7 @@ export interface TransactionProps {
|
||||
metadata: Record<string, unknown> | undefined;
|
||||
}
|
||||
|
||||
export class Transaction implements Entity<TransactionId> {
|
||||
readonly id: TransactionId;
|
||||
export class Transaction extends Entity<TransactionId> {
|
||||
readonly walletId: LeagueWalletId;
|
||||
readonly type: TransactionType;
|
||||
readonly amount: Money;
|
||||
@@ -48,7 +47,8 @@ export class Transaction implements Entity<TransactionId> {
|
||||
readonly metadata: Record<string, unknown> | undefined;
|
||||
|
||||
private constructor(props: TransactionProps) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.walletId = props.walletId;
|
||||
this.type = props.type;
|
||||
this.amount = props.amount;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Penalties can be applied as a result of an upheld protest or directly by stewards.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../../errors/RacingDomainError';
|
||||
import { AppliedAt } from '../AppliedAt';
|
||||
import { DriverId } from '../DriverId';
|
||||
@@ -60,8 +60,9 @@ export function penaltyTypeRequiresValue(type: PenaltyTypeValue): boolean {
|
||||
return PENALTY_TYPES_REQUIRING_VALUE.includes(type);
|
||||
}
|
||||
|
||||
export class Penalty implements Entity<string> {
|
||||
private constructor(private readonly props: PenaltyProps) {}
|
||||
export class Penalty extends Entity<PenaltyId> {
|
||||
private constructor(private readonly props: PenaltyProps) {
|
||||
super(props.id);}
|
||||
|
||||
static create(props: {
|
||||
id: string;
|
||||
@@ -154,7 +155,6 @@ export class Penalty implements Entity<string> {
|
||||
});
|
||||
}
|
||||
|
||||
get id(): string { return this.props.id.toString(); }
|
||||
get leagueId(): string { return this.props.leagueId.toString(); }
|
||||
get raceId(): string { return this.props.raceId.toString(); }
|
||||
get driverId(): string { return this.props.driverId.toString(); }
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Represents a prize awarded to a driver for a specific position in a season.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../../errors/RacingDomainError';
|
||||
|
||||
import type { Money } from '../../value-objects/Money';
|
||||
@@ -27,8 +27,7 @@ export interface PrizeProps {
|
||||
description: string | undefined;
|
||||
}
|
||||
|
||||
export class Prize implements Entity<PrizeId> {
|
||||
readonly id: PrizeId;
|
||||
export class Prize extends Entity<PrizeId> {
|
||||
readonly seasonId: SeasonId;
|
||||
readonly position: Position;
|
||||
readonly amount: Money;
|
||||
@@ -40,7 +39,8 @@ export class Prize implements Entity<PrizeId> {
|
||||
readonly description: string | undefined;
|
||||
|
||||
private constructor(props: PrizeProps) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.seasonId = props.seasonId;
|
||||
this.position = props.position;
|
||||
this.amount = props.amount;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Immutable entity with factory methods and domain validation.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../../errors/RacingDomainError';
|
||||
import { DriverId } from '../DriverId';
|
||||
import { RaceId } from '../RaceId';
|
||||
@@ -13,8 +13,7 @@ import { IncidentCount } from './IncidentCount';
|
||||
import { LapTime } from './LapTime';
|
||||
import { Position } from './Position';
|
||||
|
||||
export class Result implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class Result extends Entity<string> {
|
||||
readonly raceId: RaceId;
|
||||
readonly driverId: DriverId;
|
||||
readonly position: Position;
|
||||
@@ -31,7 +30,8 @@ export class Result implements Entity<string> {
|
||||
incidents: IncidentCount;
|
||||
startPosition: Position;
|
||||
}) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.raceId = props.raceId;
|
||||
this.driverId = props.driverId;
|
||||
this.position = props.position;
|
||||
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
} from '@core/racing/domain/errors/RacingDomainError';
|
||||
|
||||
import { SeasonScoringConfig } from '@core/racing/domain/value-objects/SeasonScoringConfig';
|
||||
import {
|
||||
SeasonDropPolicy,
|
||||
} from '@core/racing/domain/value-objects/SeasonDropPolicy';
|
||||
import { SeasonStewardingConfig } from '@core/racing/domain/value-objects/SeasonStewardingConfig';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import {
|
||||
RacingDomainInvariantError,
|
||||
RacingDomainValidationError,
|
||||
@@ -11,8 +11,7 @@ import type { SeasonScoringConfig } from '../../value-objects/SeasonScoringConfi
|
||||
import { SeasonStatus, SeasonStatusValue } from '../../value-objects/SeasonStatus';
|
||||
import type { SeasonStewardingConfig } from '../../value-objects/SeasonStewardingConfig';
|
||||
|
||||
export class Season implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class Season extends Entity<string> {
|
||||
readonly leagueId: string;
|
||||
readonly gameId: string;
|
||||
readonly name: string;
|
||||
@@ -49,7 +48,8 @@ export class Season implements Entity<string> {
|
||||
maxDrivers?: number;
|
||||
participantCount: ParticipantCount;
|
||||
}) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.leagueId = props.leagueId;
|
||||
this.gameId = props.gameId;
|
||||
this.name = props.name;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Aggregate root for managing sponsorship slots and pricing.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../../errors/RacingDomainError';
|
||||
|
||||
import type { Money } from '../../value-objects/Money';
|
||||
@@ -32,8 +32,7 @@ export interface SeasonSponsorshipProps {
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export class SeasonSponsorship implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class SeasonSponsorship extends Entity<string> {
|
||||
readonly seasonId: string;
|
||||
readonly leagueId: string | undefined;
|
||||
readonly sponsorId: string;
|
||||
@@ -47,7 +46,8 @@ export class SeasonSponsorship implements Entity<string> {
|
||||
readonly description: string | undefined;
|
||||
|
||||
private constructor(props: SeasonSponsorshipProps) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.seasonId = props.seasonId;
|
||||
this.leagueId = props.leagueId;
|
||||
this.sponsorId = props.sponsorId;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Represents a sponsor that can sponsor leagues/seasons.
|
||||
* Aggregate root for sponsor information.
|
||||
*/
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { SponsorCreatedAt } from './SponsorCreatedAt';
|
||||
import { SponsorEmail } from './SponsorEmail';
|
||||
import { SponsorId } from './SponsorId';
|
||||
@@ -13,8 +13,7 @@ import { Url } from './Url';
|
||||
|
||||
// TODO sponsor is not actually the racing domain in my opinion
|
||||
|
||||
export class Sponsor implements Entity<SponsorId> {
|
||||
readonly id: SponsorId;
|
||||
export class Sponsor extends Entity<SponsorId> {
|
||||
readonly name: SponsorName;
|
||||
readonly contactEmail: SponsorEmail;
|
||||
readonly logoUrl: Url | undefined;
|
||||
@@ -29,7 +28,8 @@ export class Sponsor implements Entity<SponsorId> {
|
||||
websiteUrl?: Url;
|
||||
createdAt: SponsorCreatedAt;
|
||||
}) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.name = props.name;
|
||||
this.contactEmail = props.contactEmail;
|
||||
this.logoUrl = props.logoUrl ?? undefined;
|
||||
|
||||
Reference in New Issue
Block a user