website refactor
This commit is contained in:
@@ -5,18 +5,18 @@
|
||||
* Immutable entity with factory methods and domain validation.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { CarName } from './CarName';
|
||||
import { Manufacturer } from './Manufacturer';
|
||||
import { CarClass, CarClassType } from './CarClass';
|
||||
import { CarLicense, CarLicenseType } from './CarLicense';
|
||||
import { Year } from './Year';
|
||||
import { Horsepower } from './Horsepower';
|
||||
import { Weight } from './Weight';
|
||||
import { GameId } from './GameId';
|
||||
import { CarId } from './CarId';
|
||||
import { CarLicense, CarLicenseType } from './CarLicense';
|
||||
import { CarName } from './CarName';
|
||||
import { GameId } from './GameId';
|
||||
import { Horsepower } from './Horsepower';
|
||||
import { ImageUrl } from './ImageUrl';
|
||||
import { Manufacturer } from './Manufacturer';
|
||||
import { Weight } from './Weight';
|
||||
import { Year } from './Year';
|
||||
|
||||
export class Car implements Entity<CarId> {
|
||||
readonly id: CarId;
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
* Immutable entity with factory methods and domain validation.
|
||||
*/
|
||||
|
||||
import { MediaReference } from '@core/domain/media/MediaReference';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { RacingId } from '../value-objects/RacingId';
|
||||
import { DriverName } from '../value-objects/driver/DriverName';
|
||||
import { CountryCode } from '../value-objects/CountryCode';
|
||||
import { DriverBio } from '../value-objects/driver/DriverBio';
|
||||
import { DriverName } from '../value-objects/driver/DriverName';
|
||||
import { JoinedAt } from '../value-objects/JoinedAt';
|
||||
import { MediaReference } from '@core/domain/media/MediaReference';
|
||||
import { IRacingId } from '../value-objects/RacingId';
|
||||
|
||||
export class Driver implements Entity<string> {
|
||||
readonly id: string;
|
||||
@@ -170,4 +170,11 @@ export class Driver implements Entity<string> {
|
||||
|
||||
return new Driver(driverProps);
|
||||
}
|
||||
|
||||
equals(other: Entity<string>): boolean {
|
||||
if (!(other instanceof Driver)) {
|
||||
return false;
|
||||
}
|
||||
return this.id === other.id;
|
||||
}
|
||||
}
|
||||
@@ -5,15 +5,15 @@
|
||||
* Includes user-placed decals and league-specific overrides.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../errors/RacingDomainError';
|
||||
import { LiveryDecal } from '../value-objects/LiveryDecal';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { CarId } from '../value-objects/CarId';
|
||||
import { DecalOverride } from '../value-objects/DecalOverride';
|
||||
import { DriverId } from '../value-objects/driver/DriverId';
|
||||
import { GameId } from './GameId';
|
||||
import { CarId } from '../value-objects/CarId';
|
||||
import { ImageUrl } from '../value-objects/ImageUrl';
|
||||
import { LiveryDecal } from '../value-objects/LiveryDecal';
|
||||
import { GameId } from './GameId';
|
||||
|
||||
export interface DriverLiveryProps {
|
||||
id: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { GameId } from './GameId';
|
||||
import { GameName } from './GameName';
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
* Represents a request to join a league.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { JoinedAt } from '../value-objects/JoinedAt';
|
||||
import { LeagueId } from './LeagueId';
|
||||
import { LeagueOwnerId } from './LeagueOwnerId';
|
||||
import { JoinedAt } from '../value-objects/JoinedAt';
|
||||
|
||||
export interface JoinRequestProps {
|
||||
id?: string;
|
||||
@@ -74,4 +74,11 @@ export class JoinRequest implements Entity<string> {
|
||||
throw new RacingDomainValidationError('Driver ID is required');
|
||||
}
|
||||
}
|
||||
|
||||
equals(other: Entity<string>): boolean {
|
||||
if (!(other instanceof JoinRequest)) {
|
||||
return false;
|
||||
}
|
||||
return this.id === other.id;
|
||||
}
|
||||
}
|
||||
@@ -5,19 +5,19 @@
|
||||
* Immutable entity with factory methods and domain validation.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { MediaReference } from '@core/domain/media/MediaReference';
|
||||
import type { 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';
|
||||
import { ParticipantCount } from '../value-objects/ParticipantCount';
|
||||
import { SessionDuration } from '../value-objects/SessionDuration';
|
||||
import { LeagueCreatedAt } from './LeagueCreatedAt';
|
||||
import { LeagueDescription } from './LeagueDescription';
|
||||
import { LeagueId } from './LeagueId';
|
||||
import { LeagueName } from './LeagueName';
|
||||
import { LeagueDescription } from './LeagueDescription';
|
||||
import { LeagueOwnerId } from './LeagueOwnerId';
|
||||
import { LeagueCreatedAt } from './LeagueCreatedAt';
|
||||
import { LeagueSocialLinks } from './LeagueSocialLinks';
|
||||
import { LeagueVisibility, LeagueVisibilityType } from '../value-objects/LeagueVisibility';
|
||||
import { ParticipantCount } from '../value-objects/ParticipantCount';
|
||||
import { MaxParticipants } from '../value-objects/MaxParticipants';
|
||||
import { SessionDuration } from '../value-objects/SessionDuration';
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../errors/RacingDomainError';
|
||||
import { MediaReference } from '@core/domain/media/MediaReference';
|
||||
|
||||
/**
|
||||
* Stewarding decision mode for protests
|
||||
@@ -536,4 +536,11 @@ export class League implements Entity<LeagueId> {
|
||||
canAcceptMore(): boolean {
|
||||
return !this.isFull();
|
||||
}
|
||||
|
||||
equals(other: Entity<LeagueId>): boolean {
|
||||
if (!(other instanceof League)) {
|
||||
return false;
|
||||
}
|
||||
return this.id.equals(other.id);
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,14 @@
|
||||
* Represents a driver's membership in a league.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { LeagueId } from './LeagueId';
|
||||
import { MembershipRole, MembershipRoleValue } from './MembershipRole';
|
||||
import { MembershipStatus, MembershipStatusValue } from './MembershipStatus';
|
||||
import { JoinedAt } from '../value-objects/JoinedAt';
|
||||
import { DriverId } from './DriverId';
|
||||
import { JoinRequest } from './JoinRequest';
|
||||
import { LeagueId } from './LeagueId';
|
||||
import { MembershipRole, MembershipRoleValue } from './MembershipRole';
|
||||
import { MembershipStatus, MembershipStatusValue } from './MembershipStatus';
|
||||
|
||||
export interface LeagueMembershipProps {
|
||||
id?: string;
|
||||
@@ -101,6 +101,13 @@ export class LeagueMembership implements Entity<string> {
|
||||
throw new RacingDomainValidationError('Membership role is required');
|
||||
}
|
||||
}
|
||||
|
||||
equals(other: Entity<string>): boolean {
|
||||
if (!(other instanceof LeagueMembership)) {
|
||||
return false;
|
||||
}
|
||||
return this.id === other.id;
|
||||
}
|
||||
}
|
||||
|
||||
export { MembershipRole, MembershipStatus, JoinRequest };
|
||||
export { JoinRequest, MembershipRole, MembershipStatus };
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
* Represents the scoring configuration for a league season.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { ChampionshipConfig } from '../types/ChampionshipConfig';
|
||||
import { SeasonId } from './season/SeasonId';
|
||||
import { ScoringPresetId } from './ScoringPresetId';
|
||||
import { LeagueScoringConfigId } from './LeagueScoringConfigId';
|
||||
import { ScoringPresetId } from './ScoringPresetId';
|
||||
import { SeasonId } from './season/SeasonId';
|
||||
|
||||
export interface LeagueScoringConfigProps {
|
||||
id?: string;
|
||||
|
||||
@@ -5,16 +5,16 @@
|
||||
* Contains base image and sponsor decal placements.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../errors/RacingDomainError';
|
||||
import type { LiveryDecal } from '../value-objects/LiveryDecal';
|
||||
import { LiveryTemplateId } from './LiveryTemplateId';
|
||||
import { LeagueId } from './LeagueId';
|
||||
import { SeasonId } from './season/SeasonId';
|
||||
import type { 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';
|
||||
import { ImageUrl } from './ImageUrl';
|
||||
import { LeagueId } from './LeagueId';
|
||||
import { LiveryTemplateCreatedAt } from './LiveryTemplateCreatedAt';
|
||||
import { LiveryTemplateId } from './LiveryTemplateId';
|
||||
import { LiveryTemplateUpdatedAt } from './LiveryTemplateUpdatedAt';
|
||||
import { SeasonId } from './season/SeasonId';
|
||||
|
||||
export class LiveryTemplate implements Entity<LiveryTemplateId> {
|
||||
readonly id: LiveryTemplateId;
|
||||
|
||||
@@ -11,21 +11,21 @@
|
||||
* - dismissed: Protest was dismissed (no action taken)
|
||||
* - withdrawn: Protesting driver withdrew the protest
|
||||
*/
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../errors/RacingDomainError';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { ProtestId } from './ProtestId';
|
||||
import { RaceId } from './RaceId';
|
||||
import { DriverId } from './DriverId';
|
||||
import { StewardId } from './StewardId';
|
||||
import { ProtestStatus } from './ProtestStatus';
|
||||
import { ProtestIncident } from './ProtestIncident';
|
||||
import { ProtestComment } from './ProtestComment';
|
||||
import { VideoUrl } from './VideoUrl';
|
||||
import { FiledAt } from './FiledAt';
|
||||
import { ReviewedAt } from './ReviewedAt';
|
||||
import { ProtestDefense } from './ProtestDefense';
|
||||
import { DefenseRequestedAt } from './DefenseRequestedAt';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { DecisionNotes } from './DecisionNotes';
|
||||
import { DefenseRequestedAt } from './DefenseRequestedAt';
|
||||
import { DriverId } from './DriverId';
|
||||
import { FiledAt } from './FiledAt';
|
||||
import { ProtestComment } from './ProtestComment';
|
||||
import { ProtestDefense } from './ProtestDefense';
|
||||
import { ProtestId } from './ProtestId';
|
||||
import { ProtestIncident } from './ProtestIncident';
|
||||
import { ProtestStatus } from './ProtestStatus';
|
||||
import { RaceId } from './RaceId';
|
||||
import { ReviewedAt } from './ReviewedAt';
|
||||
import { StewardId } from './StewardId';
|
||||
import { VideoUrl } from './VideoUrl';
|
||||
|
||||
export interface ProtestProps {
|
||||
id: ProtestId;
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
* Immutable entity with factory methods and domain validation.
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../errors/RacingDomainError';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { SessionType } from '../value-objects/SessionType';
|
||||
import { RaceStatus, RaceStatusValue } from '../value-objects/RaceStatus';
|
||||
import { ParticipantCount } from '../value-objects/ParticipantCount';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { MaxParticipants } from '../value-objects/MaxParticipants';
|
||||
import { ParticipantCount } from '../value-objects/ParticipantCount';
|
||||
import { RaceStatus, RaceStatusValue } from '../value-objects/RaceStatus';
|
||||
import { SessionType } from '../value-objects/SessionType';
|
||||
import { StrengthOfField } from '../value-objects/StrengthOfField';
|
||||
|
||||
export type { RaceStatus, RaceStatusValue } from '../value-objects/RaceStatus';
|
||||
@@ -486,4 +486,11 @@ export class Race implements Entity<string> {
|
||||
getStatus(): string {
|
||||
return this.status.toString();
|
||||
}
|
||||
|
||||
equals(other: Entity<string>): boolean {
|
||||
if (!(other instanceof Race)) {
|
||||
return false;
|
||||
}
|
||||
return this.id === other.id;
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,10 @@
|
||||
* Immutable aggregate root with factory methods and domain validation.
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../errors/RacingDomainError';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { Session } from './Session';
|
||||
import type { 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';
|
||||
|
||||
@@ -280,4 +280,11 @@ export class RaceEvent implements Entity<string> {
|
||||
isClosed(): boolean {
|
||||
return this.status === 'closed';
|
||||
}
|
||||
|
||||
equals(other: Entity<string>): boolean {
|
||||
if (!(other instanceof RaceEvent)) {
|
||||
return false;
|
||||
}
|
||||
return this.id === other.id;
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,10 @@
|
||||
* Represents a registration of a driver for a specific race.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { RaceId } from './RaceId';
|
||||
import { DriverId } from './DriverId';
|
||||
import { RaceId } from './RaceId';
|
||||
import { RegisteredAt } from './RegisteredAt';
|
||||
|
||||
export interface RaceRegistrationProps {
|
||||
@@ -73,4 +73,11 @@ export class RaceRegistration implements Entity<string> {
|
||||
throw new RacingDomainValidationError('Driver ID is required');
|
||||
}
|
||||
}
|
||||
|
||||
equals(other: Entity<string>): boolean {
|
||||
if (!(other instanceof RaceRegistration)) {
|
||||
return false;
|
||||
}
|
||||
return this.id === other.id;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
* Enhanced Result entity with detailed incident tracking
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { RaceIncidents, type IncidentRecord } from '../value-objects/RaceIncidents';
|
||||
import { DriverId } from './DriverId';
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* Immutable entity with factory methods and domain validation.
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../errors/RacingDomainError';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { 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';
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
* (driver, team, race, or league/season). The entity owner must approve/reject.
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../errors/RacingDomainError';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
|
||||
import type { Money } from '../value-objects/Money';
|
||||
import type { SponsorshipTier } from './season/SeasonSponsorship';
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
*/
|
||||
|
||||
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { LeagueId } from './LeagueId';
|
||||
import { DriverId } from './DriverId';
|
||||
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;
|
||||
@@ -115,6 +115,13 @@ export class Standing implements Entity<string> {
|
||||
}
|
||||
}
|
||||
|
||||
equals(other: Entity<string>): boolean {
|
||||
if (!(other instanceof Standing)) {
|
||||
return false;
|
||||
}
|
||||
return this.id === other.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add points from a race result
|
||||
*/
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
* basic invariants around identity and core properties.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { MediaReference } from '@core/domain/media/MediaReference';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { TeamCreatedAt } from '../value-objects/TeamCreatedAt';
|
||||
import { TeamDescription } from '../value-objects/TeamDescription';
|
||||
import { TeamName } from '../value-objects/TeamName';
|
||||
import { TeamTag } from '../value-objects/TeamTag';
|
||||
import { TeamDescription } from '../value-objects/TeamDescription';
|
||||
import { DriverId } from './DriverId';
|
||||
import { LeagueId } from './LeagueId';
|
||||
import { TeamCreatedAt } from '../value-objects/TeamCreatedAt';
|
||||
import { MediaReference } from '@core/domain/media/MediaReference';
|
||||
|
||||
export class Team implements Entity<string> {
|
||||
readonly id: string;
|
||||
@@ -159,4 +159,10 @@ export class Team implements Entity<string> {
|
||||
});
|
||||
}
|
||||
|
||||
equals(other: Entity<string>): boolean {
|
||||
if (!(other instanceof Team)) {
|
||||
return false;
|
||||
}
|
||||
return this.id === other.id;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { TeamRatingEventId } from '../value-objects/TeamRatingEventId';
|
||||
import { TeamRatingDimensionKey } from '../value-objects/TeamRatingDimensionKey';
|
||||
import type { Entity, IEntity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { TeamRatingDelta } from '../value-objects/TeamRatingDelta';
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../errors/RacingDomainError';
|
||||
import { TeamRatingDimensionKey } from '../value-objects/TeamRatingDimensionKey';
|
||||
import { TeamRatingEventId } from '../value-objects/TeamRatingEventId';
|
||||
|
||||
export interface TeamRatingEventSource {
|
||||
type: 'race' | 'penalty' | 'vote' | 'adminAction' | 'manualAdjustment';
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
* Immutable entity with factory methods and domain validation.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { TrackName } from '../value-objects/TrackName';
|
||||
import { TrackShortName } from '../value-objects/TrackShortName';
|
||||
import { TrackCountry } from '../value-objects/TrackCountry';
|
||||
import { TrackLength } from '../value-objects/TrackLength';
|
||||
import { TrackTurns } from '../value-objects/TrackTurns';
|
||||
import { TrackGameId } from '../value-objects/TrackGameId';
|
||||
import { TrackImageUrl } from '../value-objects/TrackImageUrl';
|
||||
import { TrackLength } from '../value-objects/TrackLength';
|
||||
import { TrackName } from '../value-objects/TrackName';
|
||||
import { TrackShortName } from '../value-objects/TrackShortName';
|
||||
import { TrackTurns } from '../value-objects/TrackTurns';
|
||||
|
||||
export type TrackCategory = 'oval' | 'road' | 'street' | 'dirt';
|
||||
export type TrackDifficulty = 'beginner' | 'intermediate' | 'advanced' | 'expert';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../../errors/RacingDomainError';
|
||||
import type { ParticipantRef } from '../../types/ParticipantRef';
|
||||
import { Points } from '../../value-objects/Points';
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
* Aggregate root for managing league finances and transactions.
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../../errors/RacingDomainError';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../../errors/RacingDomainError';
|
||||
|
||||
import type { Money } from '../../value-objects/Money';
|
||||
import { LeagueWalletId } from './LeagueWalletId';
|
||||
import { LeagueId } from '../LeagueId';
|
||||
import { LeagueWalletId } from './LeagueWalletId';
|
||||
import { TransactionId } from './TransactionId';
|
||||
|
||||
export interface LeagueWalletProps {
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
* Represents a financial transaction in the league wallet system.
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../../errors/RacingDomainError';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../../errors/RacingDomainError';
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import type { Money } from '../../value-objects/Money';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { TransactionId } from './TransactionId';
|
||||
import { LeagueWalletId } from './LeagueWalletId';
|
||||
import { TransactionId } from './TransactionId';
|
||||
|
||||
export type TransactionType =
|
||||
| 'sponsorship_payment'
|
||||
|
||||
@@ -5,21 +5,21 @@
|
||||
* Penalties can be applied as a result of an upheld protest or directly by stewards.
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../../errors/RacingDomainError';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { PenaltyId } from './PenaltyId';
|
||||
import { LeagueId } from '../LeagueId';
|
||||
import { RaceId } from '../RaceId';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../../errors/RacingDomainError';
|
||||
import { AppliedAt } from '../AppliedAt';
|
||||
import { DriverId } from '../DriverId';
|
||||
import { IssuedAt } from '../IssuedAt';
|
||||
import { LeagueId } from '../LeagueId';
|
||||
import { ProtestId } from '../ProtestId';
|
||||
import { RaceId } from '../RaceId';
|
||||
import { StewardId } from '../StewardId';
|
||||
import { PenaltyId } from './PenaltyId';
|
||||
import { PenaltyNotes } from './PenaltyNotes';
|
||||
import { PenaltyReason } from './PenaltyReason';
|
||||
import { PenaltyStatus } from './PenaltyStatus';
|
||||
import { PenaltyType, type PenaltyTypeValue } from './PenaltyType';
|
||||
import { PenaltyValue } from './PenaltyValue';
|
||||
import { PenaltyReason } from './PenaltyReason';
|
||||
import { ProtestId } from '../ProtestId';
|
||||
import { StewardId } from '../StewardId';
|
||||
import { PenaltyStatus } from './PenaltyStatus';
|
||||
import { IssuedAt } from '../IssuedAt';
|
||||
import { AppliedAt } from '../AppliedAt';
|
||||
import { PenaltyNotes } from './PenaltyNotes';
|
||||
|
||||
export interface PenaltyProps {
|
||||
id: PenaltyId;
|
||||
@@ -239,4 +239,11 @@ export class Penalty implements Entity<string> {
|
||||
return 'Penalty';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
equals(other: Entity<string>): boolean {
|
||||
if (!(other instanceof Penalty)) {
|
||||
return false;
|
||||
}
|
||||
return this.id === other.id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
* Represents a prize awarded to a driver for a specific position in a season.
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../../errors/RacingDomainError';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../../errors/RacingDomainError';
|
||||
|
||||
import type { Money } from '../../value-objects/Money';
|
||||
import { Position } from '../championship/Position';
|
||||
import { DriverId } from '../DriverId';
|
||||
import { SeasonId } from '../season/SeasonId';
|
||||
import { PrizeId } from './PrizeId';
|
||||
import { PrizeStatus } from './PrizeStatus';
|
||||
import { SeasonId } from '../season/SeasonId';
|
||||
import { DriverId } from '../DriverId';
|
||||
|
||||
export interface PrizeProps {
|
||||
id: PrizeId;
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
* Immutable entity with factory methods and domain validation.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainValidationError } from '../../errors/RacingDomainError';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { RaceId } from '../RaceId';
|
||||
import { DriverId } from '../DriverId';
|
||||
import { Position } from './Position';
|
||||
import { LapTime } from './LapTime';
|
||||
import { RaceId } from '../RaceId';
|
||||
import { IncidentCount } from './IncidentCount';
|
||||
import { LapTime } from './LapTime';
|
||||
import { Position } from './Position';
|
||||
|
||||
export class Result implements Entity<string> {
|
||||
readonly id: string;
|
||||
@@ -121,6 +121,13 @@ export class Result implements Entity<string> {
|
||||
}
|
||||
}
|
||||
|
||||
equals(other: Entity<string>): boolean {
|
||||
if (!(other instanceof Result)) {
|
||||
return false;
|
||||
}
|
||||
return this.id === other.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate positions gained/lost
|
||||
*/
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import {
|
||||
RacingDomainInvariantError,
|
||||
RacingDomainValidationError,
|
||||
RacingDomainInvariantError,
|
||||
RacingDomainValidationError,
|
||||
} from '../../errors/RacingDomainError';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { MaxParticipants } from '../../value-objects/MaxParticipants';
|
||||
import { ParticipantCount } from '../../value-objects/ParticipantCount';
|
||||
import type { SeasonDropPolicy } from '../../value-objects/SeasonDropPolicy';
|
||||
import type { SeasonSchedule } from '../../value-objects/SeasonSchedule';
|
||||
import type { SeasonScoringConfig } from '../../value-objects/SeasonScoringConfig';
|
||||
import type { SeasonDropPolicy } from '../../value-objects/SeasonDropPolicy';
|
||||
import type { SeasonStewardingConfig } from '../../value-objects/SeasonStewardingConfig';
|
||||
import { SeasonStatus, SeasonStatusValue } from '../../value-objects/SeasonStatus';
|
||||
import { ParticipantCount } from '../../value-objects/ParticipantCount';
|
||||
import { MaxParticipants } from '../../value-objects/MaxParticipants';
|
||||
import type { SeasonStewardingConfig } from '../../value-objects/SeasonStewardingConfig';
|
||||
|
||||
export class Season implements Entity<string> {
|
||||
readonly id: string;
|
||||
@@ -662,4 +662,11 @@ export class Season implements Entity<string> {
|
||||
participantCount: newCount.toNumber(),
|
||||
});
|
||||
}
|
||||
|
||||
equals(other: Entity<string>): boolean {
|
||||
if (!(other instanceof Season)) {
|
||||
return false;
|
||||
}
|
||||
return this.id === other.id;
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@
|
||||
* Aggregate root for managing sponsorship slots and pricing.
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../../errors/RacingDomainError';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../../errors/RacingDomainError';
|
||||
|
||||
import type { Money } from '../../value-objects/Money';
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Represents a sponsor that can sponsor leagues/seasons.
|
||||
* Aggregate root for sponsor information.
|
||||
*/
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { SponsorCreatedAt } from './SponsorCreatedAt';
|
||||
import { SponsorEmail } from './SponsorEmail';
|
||||
import { SponsorId } from './SponsorId';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain/ValueObject';
|
||||
|
||||
export class CountryCode implements ValueObject<string> {
|
||||
private constructor(private readonly value: string) {}
|
||||
@@ -19,11 +19,11 @@ export class CountryCode implements ValueObject<string> {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
equals(other: IValueObject<string>): boolean {
|
||||
equals(other: ValueObject<string>): boolean {
|
||||
return this.value === other.props;
|
||||
}
|
||||
|
||||
get props(): string {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain/ValueObject';
|
||||
|
||||
export class JoinedAt implements ValueObject<Date> {
|
||||
private constructor(private readonly value: Date) {}
|
||||
@@ -20,7 +20,7 @@ export class JoinedAt implements ValueObject<Date> {
|
||||
return new Date(this.value);
|
||||
}
|
||||
|
||||
equals(other: IValueObject<Date>): boolean {
|
||||
equals(other: ValueObject<Date>): boolean {
|
||||
return this.props.getTime() === other.props.getTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export class Points implements ValueObject<{ value: number }> {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
equals(other: IValueObject<{ value: number }>): boolean {
|
||||
equals(other: ValueObject<{ value: number }>): boolean {
|
||||
return this.value === other.props.value;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { RacingId } from './RacingId';
|
||||
import { IRacingId } from './RacingId';
|
||||
|
||||
describe('IRacingId', () => {
|
||||
it('should create an iRacing id', () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain/ValueObject';
|
||||
|
||||
export class IRacingId implements ValueObject<string> {
|
||||
private constructor(private readonly value: string) {}
|
||||
@@ -19,7 +19,7 @@ export class IRacingId implements ValueObject<string> {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
equals(other: IValueObject<string>): boolean {
|
||||
equals(other: ValueObject<string>): boolean {
|
||||
return this.props === other.props;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { RacingDomainValidationError } from '../../errors/RacingDomainError';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain/ValueObject';
|
||||
|
||||
export interface DriverBioProps {
|
||||
value: string;
|
||||
@@ -19,7 +19,7 @@ export class DriverBio implements ValueObject<DriverBioProps> {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
equals(other: IValueObject<DriverBioProps>): boolean {
|
||||
equals(other: ValueObject<DriverBioProps>): boolean {
|
||||
return this.props.value === other.props.value;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { RacingDomainValidationError } from '../../errors/RacingDomainError';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain/ValueObject';
|
||||
|
||||
export interface DriverNameProps {
|
||||
value: string;
|
||||
@@ -19,7 +19,7 @@ export class DriverName implements ValueObject<DriverNameProps> {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
equals(other: IValueObject<DriverNameProps>): boolean {
|
||||
equals(other: ValueObject<DriverNameProps>): boolean {
|
||||
return this.props.value === other.props.value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user