website refactor
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* Immutable entity with factory methods and domain validation.
|
||||
*/
|
||||
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { CarName } from './CarName';
|
||||
import { Manufacturer } from './Manufacturer';
|
||||
@@ -18,7 +18,7 @@ import { GameId } from './GameId';
|
||||
import { CarId } from './CarId';
|
||||
import { ImageUrl } from './ImageUrl';
|
||||
|
||||
export class Car implements IEntity<CarId> {
|
||||
export class Car implements Entity<CarId> {
|
||||
readonly id: CarId;
|
||||
readonly name: CarName;
|
||||
readonly shortName: string;
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import { IRacingId } from '../value-objects/IRacingId';
|
||||
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 { JoinedAt } from '../value-objects/JoinedAt';
|
||||
import { MediaReference } from '@core/domain/media/MediaReference';
|
||||
|
||||
export class Driver implements IEntity<string> {
|
||||
export class Driver implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly iracingId: IRacingId;
|
||||
readonly name: DriverName;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Includes user-placed decals and league-specific overrides.
|
||||
*/
|
||||
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../errors/RacingDomainError';
|
||||
import { LiveryDecal } from '../value-objects/LiveryDecal';
|
||||
@@ -28,7 +28,7 @@ export interface DriverLiveryProps {
|
||||
validatedAt: Date | undefined;
|
||||
}
|
||||
|
||||
export class DriverLivery implements IEntity<string> {
|
||||
export class DriverLivery implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly driverId: DriverId;
|
||||
readonly gameId: GameId;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { GameId } from './GameId';
|
||||
import { GameName } from './GameName';
|
||||
|
||||
export class Game implements IEntity<GameId> {
|
||||
export class Game implements Entity<GameId> {
|
||||
readonly id: GameId;
|
||||
readonly name: GameName;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Represents a request to join a league.
|
||||
*/
|
||||
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { LeagueId } from './LeagueId';
|
||||
import { LeagueOwnerId } from './LeagueOwnerId';
|
||||
@@ -18,7 +18,7 @@ export interface JoinRequestProps {
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export class JoinRequest implements IEntity<string> {
|
||||
export class JoinRequest implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly leagueId: LeagueId;
|
||||
readonly driverId: LeagueOwnerId;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Immutable entity with factory methods and domain validation.
|
||||
*/
|
||||
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { LeagueId } from './LeagueId';
|
||||
import { LeagueName } from './LeagueName';
|
||||
import { LeagueDescription } from './LeagueDescription';
|
||||
@@ -91,7 +91,7 @@ export interface LeagueSettings {
|
||||
visibility?: LeagueVisibilityType;
|
||||
}
|
||||
|
||||
export class League implements IEntity<LeagueId> {
|
||||
export class League implements Entity<LeagueId> {
|
||||
readonly id: LeagueId;
|
||||
readonly name: LeagueName;
|
||||
readonly description: LeagueDescription;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Represents a driver's membership in a league.
|
||||
*/
|
||||
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { LeagueId } from './LeagueId';
|
||||
import { MembershipRole, MembershipRoleValue } from './MembershipRole';
|
||||
@@ -22,7 +22,7 @@ export interface LeagueMembershipProps {
|
||||
joinedAt?: Date;
|
||||
}
|
||||
|
||||
export class LeagueMembership implements IEntity<string> {
|
||||
export class LeagueMembership implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly leagueId: LeagueId;
|
||||
readonly driverId: DriverId;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Represents the scoring configuration for a league season.
|
||||
*/
|
||||
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { ChampionshipConfig } from '../types/ChampionshipConfig';
|
||||
import { SeasonId } from './season/SeasonId';
|
||||
@@ -25,7 +25,7 @@ export interface LeagueScoringConfigRehydrateProps {
|
||||
championships: ChampionshipConfig[];
|
||||
}
|
||||
|
||||
export class LeagueScoringConfig implements IEntity<LeagueScoringConfigId> {
|
||||
export class LeagueScoringConfig implements Entity<LeagueScoringConfigId> {
|
||||
readonly id: LeagueScoringConfigId;
|
||||
readonly seasonId: SeasonId;
|
||||
readonly scoringPresetId: ScoringPresetId | undefined;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Contains base image and sponsor decal placements.
|
||||
*/
|
||||
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../errors/RacingDomainError';
|
||||
import type { LiveryDecal } from '../value-objects/LiveryDecal';
|
||||
import { LiveryTemplateId } from './LiveryTemplateId';
|
||||
@@ -16,7 +16,7 @@ import { ImageUrl } from './ImageUrl';
|
||||
import { LiveryTemplateCreatedAt } from './LiveryTemplateCreatedAt';
|
||||
import { LiveryTemplateUpdatedAt } from './LiveryTemplateUpdatedAt';
|
||||
|
||||
export class LiveryTemplate implements IEntity<LiveryTemplateId> {
|
||||
export class LiveryTemplate implements Entity<LiveryTemplateId> {
|
||||
readonly id: LiveryTemplateId;
|
||||
readonly leagueId: LeagueId;
|
||||
readonly seasonId: SeasonId;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* - withdrawn: Protesting driver withdrew the protest
|
||||
*/
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../errors/RacingDomainError';
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { ProtestId } from './ProtestId';
|
||||
import { RaceId } from './RaceId';
|
||||
import { DriverId } from './DriverId';
|
||||
@@ -58,7 +58,7 @@ export interface ProtestProps {
|
||||
defenseRequestedBy?: StewardId;
|
||||
}
|
||||
|
||||
export class Protest implements IEntity<string> {
|
||||
export class Protest implements Entity<string> {
|
||||
private constructor(private readonly props: ProtestProps) {}
|
||||
|
||||
static create(props: {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../errors/RacingDomainError';
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
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';
|
||||
@@ -15,7 +15,7 @@ import { StrengthOfField } from '../value-objects/StrengthOfField';
|
||||
|
||||
export type { RaceStatus, RaceStatusValue } from '../value-objects/RaceStatus';
|
||||
|
||||
export class Race implements IEntity<string> {
|
||||
export class Race implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly leagueId: string;
|
||||
readonly scheduledAt: Date;
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../errors/RacingDomainError';
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { Session } from './Session';
|
||||
import { SessionType } from '../value-objects/SessionType';
|
||||
|
||||
export type RaceEventStatus = 'scheduled' | 'in_progress' | 'awaiting_stewarding' | 'closed' | 'cancelled';
|
||||
|
||||
export class RaceEvent implements IEntity<string> {
|
||||
export class RaceEvent implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly seasonId: string;
|
||||
readonly leagueId: string;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Represents a registration of a driver for a specific race.
|
||||
*/
|
||||
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { RaceId } from './RaceId';
|
||||
import { DriverId } from './DriverId';
|
||||
@@ -17,7 +17,7 @@ export interface RaceRegistrationProps {
|
||||
registeredAt?: Date;
|
||||
}
|
||||
|
||||
export class RaceRegistration implements IEntity<string> {
|
||||
export class RaceRegistration implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly raceId: RaceId;
|
||||
readonly driverId: DriverId;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Enhanced Result entity with detailed incident tracking
|
||||
*/
|
||||
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { RaceIncidents, type IncidentRecord } from '../value-objects/RaceIncidents';
|
||||
import { DriverId } from './DriverId';
|
||||
@@ -10,7 +10,7 @@ import { RaceId } from './RaceId';
|
||||
import { LapTime } from './result/LapTime';
|
||||
import { Position } from './result/Position';
|
||||
|
||||
export class ResultWithIncidents implements IEntity<string> {
|
||||
export class ResultWithIncidents implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly raceId: RaceId;
|
||||
readonly driverId: DriverId;
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../errors/RacingDomainError';
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { SessionType } from '../value-objects/SessionType';
|
||||
|
||||
export type SessionStatus = 'scheduled' | 'running' | 'completed' | 'cancelled';
|
||||
|
||||
export class Session implements IEntity<string> {
|
||||
export class Session implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly raceEventId: string;
|
||||
readonly scheduledAt: Date;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../errors/RacingDomainError';
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
|
||||
import type { Money } from '../value-objects/Money';
|
||||
import type { SponsorshipTier } from './season/SeasonSponsorship';
|
||||
@@ -29,7 +29,7 @@ export interface SponsorshipRequestProps {
|
||||
rejectionReason?: string;
|
||||
}
|
||||
|
||||
export class SponsorshipRequest implements IEntity<string> {
|
||||
export class SponsorshipRequest implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly sponsorId: string;
|
||||
readonly entityType: SponsorableEntityType;
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
*/
|
||||
|
||||
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { LeagueId } from './LeagueId';
|
||||
import { DriverId } from './DriverId';
|
||||
import { Points } from '../value-objects/Points';
|
||||
import { Position } from './championship/Position';
|
||||
|
||||
export class Standing implements IEntity<string> {
|
||||
export class Standing implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly leagueId: LeagueId;
|
||||
readonly driverId: DriverId;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* basic invariants around identity and core properties.
|
||||
*/
|
||||
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { TeamName } from '../value-objects/TeamName';
|
||||
import { TeamTag } from '../value-objects/TeamTag';
|
||||
@@ -16,7 +16,7 @@ import { LeagueId } from './LeagueId';
|
||||
import { TeamCreatedAt } from '../value-objects/TeamCreatedAt';
|
||||
import { MediaReference } from '@core/domain/media/MediaReference';
|
||||
|
||||
export class Team implements IEntity<string> {
|
||||
export class Team implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly name: TeamName;
|
||||
readonly tag: TeamTag;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { TeamRatingEventId } from '../value-objects/TeamRatingEventId';
|
||||
import { TeamRatingDimensionKey } from '../value-objects/TeamRatingDimensionKey';
|
||||
import { TeamRatingDelta } from '../value-objects/TeamRatingDelta';
|
||||
@@ -32,7 +32,7 @@ export interface TeamRatingEventProps {
|
||||
version: number;
|
||||
}
|
||||
|
||||
export class TeamRatingEvent implements IEntity<TeamRatingEventId> {
|
||||
export class TeamRatingEvent implements Entity<TeamRatingEventId> {
|
||||
readonly id: TeamRatingEventId;
|
||||
readonly teamId: string;
|
||||
readonly dimension: TeamRatingDimensionKey;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
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';
|
||||
@@ -18,7 +18,7 @@ import { TrackImageUrl } from '../value-objects/TrackImageUrl';
|
||||
export type TrackCategory = 'oval' | 'road' | 'street' | 'dirt';
|
||||
export type TrackDifficulty = 'beginner' | 'intermediate' | 'advanced' | 'expert';
|
||||
|
||||
export class Track implements IEntity<string> {
|
||||
export class Track implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly name: TrackName;
|
||||
readonly shortName: TrackShortName;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
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 IEntity<string> {
|
||||
export class ChampionshipStanding implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly seasonId: string;
|
||||
readonly championshipId: string;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../../errors/RacingDomainError';
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
|
||||
import type { Money } from '../../value-objects/Money';
|
||||
import { LeagueWalletId } from './LeagueWalletId';
|
||||
@@ -21,7 +21,7 @@ export interface LeagueWalletProps {
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
export class LeagueWallet implements IEntity<LeagueWalletId> {
|
||||
export class LeagueWallet implements Entity<LeagueWalletId> {
|
||||
readonly id: LeagueWalletId;
|
||||
readonly leagueId: LeagueId;
|
||||
readonly balance: Money;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../../errors/RacingDomainError';
|
||||
|
||||
import type { Money } from '../../value-objects/Money';
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { TransactionId } from './TransactionId';
|
||||
import { LeagueWalletId } from './LeagueWalletId';
|
||||
|
||||
@@ -34,7 +34,7 @@ export interface TransactionProps {
|
||||
metadata: Record<string, unknown> | undefined;
|
||||
}
|
||||
|
||||
export class Transaction implements IEntity<TransactionId> {
|
||||
export class Transaction implements Entity<TransactionId> {
|
||||
readonly id: TransactionId;
|
||||
readonly walletId: LeagueWalletId;
|
||||
readonly type: TransactionType;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../../errors/RacingDomainError';
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { PenaltyId } from './PenaltyId';
|
||||
import { LeagueId } from '../LeagueId';
|
||||
import { RaceId } from '../RaceId';
|
||||
@@ -60,7 +60,7 @@ export function penaltyTypeRequiresValue(type: PenaltyTypeValue): boolean {
|
||||
return PENALTY_TYPES_REQUIRING_VALUE.includes(type);
|
||||
}
|
||||
|
||||
export class Penalty implements IEntity<string> {
|
||||
export class Penalty implements Entity<string> {
|
||||
private constructor(private readonly props: PenaltyProps) {}
|
||||
|
||||
static create(props: {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../../errors/RacingDomainError';
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
|
||||
import type { Money } from '../../value-objects/Money';
|
||||
import { Position } from '../championship/Position';
|
||||
@@ -27,7 +27,7 @@ export interface PrizeProps {
|
||||
description: string | undefined;
|
||||
}
|
||||
|
||||
export class Prize implements IEntity<PrizeId> {
|
||||
export class Prize implements Entity<PrizeId> {
|
||||
readonly id: PrizeId;
|
||||
readonly seasonId: SeasonId;
|
||||
readonly position: Position;
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError } from '../../errors/RacingDomainError';
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { RaceId } from '../RaceId';
|
||||
import { DriverId } from '../DriverId';
|
||||
import { Position } from './Position';
|
||||
import { LapTime } from './LapTime';
|
||||
import { IncidentCount } from './IncidentCount';
|
||||
|
||||
export class Result implements IEntity<string> {
|
||||
export class Result implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly raceId: RaceId;
|
||||
readonly driverId: DriverId;
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
RacingDomainInvariantError,
|
||||
RacingDomainValidationError,
|
||||
} from '../../errors/RacingDomainError';
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import type { SeasonSchedule } from '../../value-objects/SeasonSchedule';
|
||||
import type { SeasonScoringConfig } from '../../value-objects/SeasonScoringConfig';
|
||||
import type { SeasonDropPolicy } from '../../value-objects/SeasonDropPolicy';
|
||||
@@ -11,7 +11,7 @@ import { SeasonStatus, SeasonStatusValue } from '../../value-objects/SeasonStatu
|
||||
import { ParticipantCount } from '../../value-objects/ParticipantCount';
|
||||
import { MaxParticipants } from '../../value-objects/MaxParticipants';
|
||||
|
||||
export class Season implements IEntity<string> {
|
||||
export class Season implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly leagueId: string;
|
||||
readonly gameId: string;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError, RacingDomainInvariantError } from '../../errors/RacingDomainError';
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
|
||||
import type { Money } from '../../value-objects/Money';
|
||||
|
||||
@@ -32,7 +32,7 @@ export interface SeasonSponsorshipProps {
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export class SeasonSponsorship implements IEntity<string> {
|
||||
export class SeasonSponsorship implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly seasonId: string;
|
||||
readonly leagueId: string | undefined;
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import * as mod from '@core/racing/domain/entities/season/index';
|
||||
|
||||
describe('racing/domain/entities/season/index.ts', () => {
|
||||
it('imports', () => {
|
||||
expect(mod).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
export * from './Season';
|
||||
export * from './SeasonId';
|
||||
export * from './SeasonSponsorship';
|
||||
@@ -4,7 +4,7 @@
|
||||
* Represents a sponsor that can sponsor leagues/seasons.
|
||||
* Aggregate root for sponsor information.
|
||||
*/
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { SponsorCreatedAt } from './SponsorCreatedAt';
|
||||
import { SponsorEmail } from './SponsorEmail';
|
||||
import { SponsorId } from './SponsorId';
|
||||
@@ -13,7 +13,7 @@ import { Url } from './Url';
|
||||
|
||||
// TODO sponsor is not actually the racing domain in my opinion
|
||||
|
||||
export class Sponsor implements IEntity<SponsorId> {
|
||||
export class Sponsor implements Entity<SponsorId> {
|
||||
readonly id: SponsorId;
|
||||
readonly name: SponsorName;
|
||||
readonly contactEmail: SponsorEmail;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { IDomainError, CommonDomainErrorKind } from '@core/shared/errors';
|
||||
import type { DomainError, CommonDomainErrorKind } from '@core/shared/errors';
|
||||
|
||||
export abstract class RacingDomainError extends Error implements IDomainError<CommonDomainErrorKind> {
|
||||
export abstract class RacingDomainError extends Error implements DomainError<CommonDomainErrorKind> {
|
||||
readonly type = 'domain' as const;
|
||||
readonly context = 'racing-domain';
|
||||
abstract readonly kind: CommonDomainErrorKind;
|
||||
@@ -13,7 +13,7 @@ export abstract class RacingDomainError extends Error implements IDomainError<Co
|
||||
|
||||
export class RacingDomainValidationError
|
||||
extends RacingDomainError
|
||||
implements IDomainError<'validation'>
|
||||
implements DomainError<'validation'>
|
||||
{
|
||||
readonly kind = 'validation' as const;
|
||||
|
||||
@@ -24,7 +24,7 @@ export class RacingDomainValidationError
|
||||
|
||||
export class RacingDomainInvariantError
|
||||
extends RacingDomainError
|
||||
implements IDomainError<'invariant'>
|
||||
implements DomainError<'invariant'>
|
||||
{
|
||||
readonly kind = 'invariant' as const;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IDomainEvent } from '@core/shared/domain';
|
||||
import type { DomainEvent } from '@core/shared/domain';
|
||||
|
||||
/**
|
||||
* Domain Event: MainRaceCompleted
|
||||
@@ -15,7 +15,7 @@ export interface MainRaceCompletedEventData {
|
||||
driverIds: string[]; // Drivers who participated in the main race
|
||||
}
|
||||
|
||||
export class MainRaceCompletedEvent implements IDomainEvent<MainRaceCompletedEventData> {
|
||||
export class MainRaceCompletedEvent implements DomainEvent<MainRaceCompletedEventData> {
|
||||
readonly eventType = 'MainRaceCompleted';
|
||||
readonly aggregateId: string;
|
||||
readonly eventData: MainRaceCompletedEventData;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IDomainEvent } from '@core/shared/domain';
|
||||
import type { DomainEvent } from '@core/shared/domain';
|
||||
|
||||
/**
|
||||
* Domain Event: RaceEventStewardingClosed
|
||||
@@ -15,7 +15,7 @@ export interface RaceEventStewardingClosedEventData {
|
||||
hadPenaltiesApplied: boolean; // Whether any penalties were applied during stewarding
|
||||
}
|
||||
|
||||
export class RaceEventStewardingClosedEvent implements IDomainEvent<RaceEventStewardingClosedEventData> {
|
||||
export class RaceEventStewardingClosedEvent implements DomainEvent<RaceEventStewardingClosedEventData> {
|
||||
readonly eventType = 'RaceEventStewardingClosed';
|
||||
readonly aggregateId: string;
|
||||
readonly eventData: RaceEventStewardingClosedEventData;
|
||||
|
||||
@@ -9,7 +9,7 @@ import type { Car } from '../entities/Car';
|
||||
import type { CarClass } from '../entities/CarClass';
|
||||
import type { CarLicense } from '../entities/CarLicense';
|
||||
|
||||
export interface ICarRepository {
|
||||
export interface CarRepository {
|
||||
/**
|
||||
* Find a car by ID
|
||||
*/
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ChampionshipStanding } from '../entities/championship/ChampionshipStanding';
|
||||
|
||||
export interface IChampionshipStandingRepository {
|
||||
export interface ChampionshipStandingRepository {
|
||||
findBySeasonAndChampionship(
|
||||
seasonId: string,
|
||||
championshipId: string,
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import type { Driver } from '../entities/Driver';
|
||||
|
||||
export interface IDriverRepository {
|
||||
export interface DriverRepository {
|
||||
/**
|
||||
* Find a driver by ID
|
||||
*/
|
||||
@@ -5,9 +5,23 @@
|
||||
* This is used for caching computed stats and serving frontend data.
|
||||
*/
|
||||
|
||||
import type { DriverStats } from '../../application/use-cases/IDriverStatsUseCase';
|
||||
export interface DriverStats {
|
||||
rating: number;
|
||||
safetyRating: number;
|
||||
sportsmanshipRating: number;
|
||||
totalRaces: number;
|
||||
wins: number;
|
||||
podiums: number;
|
||||
dnfs: number;
|
||||
avgFinish: number;
|
||||
bestFinish: number;
|
||||
worstFinish: number;
|
||||
consistency: number;
|
||||
experienceLevel: string;
|
||||
overallRank: number | null;
|
||||
}
|
||||
|
||||
export interface IDriverStatsRepository {
|
||||
export interface DriverStatsRepository {
|
||||
/**
|
||||
* Get stats for a specific driver
|
||||
*/
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Game } from '../entities/Game';
|
||||
|
||||
export interface IGameRepository {
|
||||
export interface GameRepository {
|
||||
findById(id: string): Promise<Game | null>;
|
||||
findAll(): Promise<Game[]>;
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import type {
|
||||
JoinRequest,
|
||||
} from '../entities/LeagueMembership';
|
||||
|
||||
export interface ILeagueMembershipRepository {
|
||||
export interface LeagueMembershipRepository {
|
||||
/**
|
||||
* Get membership for a driver in a league, or null if none exists.
|
||||
*/
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import type { League } from '../entities/League';
|
||||
|
||||
export interface ILeagueRepository {
|
||||
export interface LeagueRepository {
|
||||
/**
|
||||
* Find a league by ID
|
||||
*/
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { LeagueScoringConfig } from '../entities/LeagueScoringConfig';
|
||||
|
||||
export interface ILeagueScoringConfigRepository {
|
||||
export interface LeagueScoringConfigRepository {
|
||||
findBySeasonId(seasonId: string): Promise<LeagueScoringConfig | null>;
|
||||
save(config: LeagueScoringConfig): Promise<LeagueScoringConfig>;
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import type { LeagueWallet } from '../entities/league-wallet/LeagueWallet';
|
||||
|
||||
export interface ILeagueWalletRepository {
|
||||
export interface LeagueWalletRepository {
|
||||
findById(id: string): Promise<LeagueWallet | null>;
|
||||
findByLeagueId(leagueId: string): Promise<LeagueWallet | null>;
|
||||
create(wallet: LeagueWallet): Promise<LeagueWallet>;
|
||||
@@ -7,7 +7,7 @@
|
||||
import type { DriverLivery } from '../entities/DriverLivery';
|
||||
import type { LiveryTemplate } from '../entities/LiveryTemplate';
|
||||
|
||||
export interface ILiveryRepository {
|
||||
export interface LiveryRepository {
|
||||
// DriverLivery operations
|
||||
findDriverLiveryById(id: string): Promise<DriverLivery | null>;
|
||||
findDriverLiveriesByDriverId(driverId: string): Promise<DriverLivery[]>;
|
||||
@@ -5,7 +5,7 @@
|
||||
* Handles frontend assets like team logos and driver avatars.
|
||||
*/
|
||||
|
||||
export interface IMediaRepository {
|
||||
export interface MediaRepository {
|
||||
/**
|
||||
* Get driver avatar URL
|
||||
*/
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import type { Penalty } from '../entities/penalty/Penalty';
|
||||
|
||||
export interface IPenaltyRepository {
|
||||
export interface PenaltyRepository {
|
||||
/**
|
||||
* Find a penalty by ID
|
||||
*/
|
||||
@@ -7,7 +7,7 @@
|
||||
import type { Prize } from '../entities/prize/Prize';
|
||||
import type { PrizeStatusValue } from '../entities/prize/PrizeStatus';
|
||||
|
||||
export interface IPrizeRepository {
|
||||
export interface PrizeRepository {
|
||||
findById(id: string): Promise<Prize | null>;
|
||||
findBySeasonId(seasonId: string): Promise<Prize[]>;
|
||||
findByDriverId(driverId: string): Promise<Prize[]>;
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import type { Protest } from '../entities/Protest';
|
||||
|
||||
export interface IProtestRepository {
|
||||
export interface ProtestRepository {
|
||||
/**
|
||||
* Find a protest by ID
|
||||
*/
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { RaceEvent } from '../entities/RaceEvent';
|
||||
|
||||
export interface IRaceEventRepository {
|
||||
export interface RaceEventRepository {
|
||||
findById(id: string): Promise<RaceEvent | null>;
|
||||
findAll(): Promise<RaceEvent[]>;
|
||||
findBySeasonId(seasonId: string): Promise<RaceEvent[]>;
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import type { RaceRegistration } from '../entities/RaceRegistration';
|
||||
|
||||
export interface IRaceRegistrationRepository {
|
||||
export interface RaceRegistrationRepository {
|
||||
/**
|
||||
* Check if a driver is registered for a race.
|
||||
*/
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import type { Race, RaceStatusValue } from '../entities/Race';
|
||||
|
||||
export interface IRaceRepository {
|
||||
export interface RaceRepository {
|
||||
/**
|
||||
* Find a race by ID
|
||||
*/
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import type { Result } from '../entities/result/Result';
|
||||
|
||||
export interface IResultRepository {
|
||||
export interface ResultRepository {
|
||||
/**
|
||||
* Find a result by ID
|
||||
*/
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Season } from '../entities/season/Season';
|
||||
|
||||
export interface ISeasonRepository {
|
||||
export interface SeasonRepository {
|
||||
findById(id: string): Promise<Season | null>;
|
||||
/**
|
||||
* Backward-compatible alias retained for existing callers.
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import type { SeasonSponsorship, SponsorshipTier } from '../entities/season/SeasonSponsorship';
|
||||
|
||||
export interface ISeasonSponsorshipRepository {
|
||||
export interface SeasonSponsorshipRepository {
|
||||
findById(id: string): Promise<SeasonSponsorship | null>;
|
||||
findBySeasonId(seasonId: string): Promise<SeasonSponsorship[]>;
|
||||
/**
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Session } from '../entities/Session';
|
||||
|
||||
export interface ISessionRepository {
|
||||
export interface SessionRepository {
|
||||
findById(id: string): Promise<Session | null>;
|
||||
findAll(): Promise<Session[]>;
|
||||
findByRaceEventId(raceEventId: string): Promise<Session[]>;
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import type { Sponsor } from '../entities/sponsor/Sponsor';
|
||||
|
||||
export interface ISponsorRepository {
|
||||
export interface SponsorRepository {
|
||||
findById(id: string): Promise<Sponsor | null>;
|
||||
findAll(): Promise<Sponsor[]>;
|
||||
findByEmail(email: string): Promise<Sponsor | null>;
|
||||
@@ -8,7 +8,7 @@
|
||||
import type { SponsorshipPricing } from '../value-objects/SponsorshipPricing';
|
||||
import type { SponsorableEntityType } from '../entities/SponsorshipRequest';
|
||||
|
||||
export interface ISponsorshipPricingRepository {
|
||||
export interface SponsorshipPricingRepository {
|
||||
/**
|
||||
* Get pricing configuration for an entity
|
||||
*/
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import type { SponsorshipRequest, SponsorableEntityType, SponsorshipRequestStatus } from '../entities/SponsorshipRequest';
|
||||
|
||||
export interface ISponsorshipRequestRepository {
|
||||
export interface SponsorshipRequestRepository {
|
||||
findById(id: string): Promise<SponsorshipRequest | null>;
|
||||
|
||||
/**
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import type { Standing } from '../entities/Standing';
|
||||
|
||||
export interface IStandingRepository {
|
||||
export interface StandingRepository {
|
||||
/**
|
||||
* Find standings by league ID (sorted by position)
|
||||
*/
|
||||
@@ -10,7 +10,7 @@ import type {
|
||||
TeamJoinRequest,
|
||||
} from '../types/TeamMembership';
|
||||
|
||||
export interface ITeamMembershipRepository {
|
||||
export interface TeamMembershipRepository {
|
||||
/**
|
||||
* Get membership for a driver in a team, or null if none exists.
|
||||
*/
|
||||
@@ -44,7 +44,7 @@ export interface PaginatedResult<T> {
|
||||
nextOffset?: number;
|
||||
}
|
||||
|
||||
export interface ITeamRatingEventRepository {
|
||||
export interface TeamRatingEventRepository {
|
||||
/**
|
||||
* Save a rating event to the ledger
|
||||
*/
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import type { TeamRatingSnapshot } from '../services/TeamRatingSnapshotCalculator';
|
||||
|
||||
export interface ITeamRatingRepository {
|
||||
export interface TeamRatingRepository {
|
||||
/**
|
||||
* Find rating snapshot by team ID
|
||||
*/
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import type { Team } from '../entities/Team';
|
||||
|
||||
export interface ITeamRepository {
|
||||
export interface TeamRepository {
|
||||
/**
|
||||
* Find a team by ID.
|
||||
*/
|
||||
@@ -16,7 +16,7 @@ export interface TeamStats {
|
||||
category?: string;
|
||||
}
|
||||
|
||||
export interface ITeamStatsRepository {
|
||||
export interface TeamStatsRepository {
|
||||
/**
|
||||
* Get stats for a specific team
|
||||
*/
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import type { Track, TrackCategory } from '../entities/Track';
|
||||
|
||||
export interface ITrackRepository {
|
||||
export interface TrackRepository {
|
||||
/**
|
||||
* Find a track by ID
|
||||
*/
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import type { Transaction, TransactionType } from '../entities/league-wallet/Transaction';
|
||||
|
||||
export interface ITransactionRepository {
|
||||
export interface TransactionRepository {
|
||||
findById(id: string): Promise<Transaction | null>;
|
||||
findByWalletId(walletId: string): Promise<Transaction[]>;
|
||||
findByType(type: TransactionType): Promise<Transaction[]>;
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { DropScorePolicy } from '../types/DropScorePolicy';
|
||||
import type { IDomainCalculationService } from '@core/shared/domain';
|
||||
import type { DomainCalculationService } from '@core/shared/domain';
|
||||
|
||||
export interface EventPointsEntry {
|
||||
eventId: string;
|
||||
@@ -17,7 +17,7 @@ export interface DropScoreInput {
|
||||
events: EventPointsEntry[];
|
||||
}
|
||||
|
||||
export class DropScoreApplier implements IDomainCalculationService<DropScoreInput, DropScoreResult> {
|
||||
export class DropScoreApplier implements DomainCalculationService<DropScoreInput, DropScoreResult> {
|
||||
calculate(input: DropScoreInput): DropScoreResult {
|
||||
return this.apply(input.policy, input.events);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { BonusRule } from '../types/BonusRule';
|
||||
import type { ChampionshipType } from '../types/ChampionshipType';
|
||||
|
||||
import type { PointsTable } from '../value-objects/PointsTable';
|
||||
import type { IDomainCalculationService } from '@core/shared/domain';
|
||||
import type { DomainCalculationService } from '@core/shared/domain';
|
||||
|
||||
export interface ParticipantEventPoints {
|
||||
participant: ParticipantRef;
|
||||
@@ -33,7 +33,7 @@ function createDriverParticipant(driverId: string): ParticipantRef {
|
||||
}
|
||||
|
||||
export class EventScoringService
|
||||
implements IDomainCalculationService<EventScoringInput, ParticipantEventPoints[]>
|
||||
implements DomainCalculationService<EventScoringInput, ParticipantEventPoints[]>
|
||||
{
|
||||
calculate(input: EventScoringInput): ParticipantEventPoints[] {
|
||||
return this.scoreSession(input);
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { RecurrenceStrategy } from '../value-objects/RecurrenceStrategy';
|
||||
import { RaceTimeOfDay } from '../value-objects/RaceTimeOfDay';
|
||||
import type { Weekday } from '../types/Weekday';
|
||||
import { weekdayToIndex } from '../types/Weekday';
|
||||
import type { IDomainCalculationService } from '@core/shared/domain';
|
||||
import type { DomainCalculationService } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
|
||||
function cloneDate(date: Date): Date {
|
||||
@@ -178,7 +178,7 @@ export class SeasonScheduleGenerator {
|
||||
}
|
||||
|
||||
export class SeasonScheduleGeneratorService
|
||||
implements IDomainCalculationService<SeasonSchedule, ScheduledRaceSlot[]>
|
||||
implements DomainCalculationService<SeasonSchedule, ScheduledRaceSlot[]>
|
||||
{
|
||||
calculate(schedule: SeasonSchedule): ScheduledRaceSlot[] {
|
||||
return SeasonScheduleGenerator.generateSlots(schedule);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IDomainService } from '@core/shared/domain';
|
||||
import type { DomainService } from '@core/shared/domain';
|
||||
|
||||
export type SkillLevel = 'beginner' | 'intermediate' | 'advanced' | 'pro';
|
||||
|
||||
@@ -6,7 +6,7 @@ export type SkillLevel = 'beginner' | 'intermediate' | 'advanced' | 'pro';
|
||||
* Domain service for determining skill level based on rating.
|
||||
* This encapsulates the business rule for skill tier classification.
|
||||
*/
|
||||
export class SkillLevelService implements IDomainService {
|
||||
export class SkillLevelService implements DomainService {
|
||||
readonly serviceName = 'SkillLevelService';
|
||||
/**
|
||||
* Map driver rating to skill level band.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IDomainCalculationService } from '@core/shared/domain';
|
||||
import type { DomainCalculationService } from '@core/shared/domain';
|
||||
|
||||
/**
|
||||
* Domain Service: StrengthOfFieldCalculator
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export class CarId implements IValueObject<string> {
|
||||
export class CarId implements ValueObject<string> {
|
||||
private constructor(private readonly value: string) {}
|
||||
|
||||
static create(value: string): CarId {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export class CountryCode implements IValueObject<string> {
|
||||
export class CountryCode implements ValueObject<string> {
|
||||
private constructor(private readonly value: string) {}
|
||||
|
||||
static create(value: string): CountryCode {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export interface DecalOverrideProps {
|
||||
leagueId: string;
|
||||
@@ -9,7 +9,7 @@ export interface DecalOverrideProps {
|
||||
newY: number;
|
||||
}
|
||||
|
||||
export class DecalOverride implements IValueObject<DecalOverrideProps> {
|
||||
export class DecalOverride implements ValueObject<DecalOverrideProps> {
|
||||
readonly leagueId: string;
|
||||
readonly seasonId: string;
|
||||
readonly decalId: string;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { IValueObject } from "../../../shared/domain/ValueObject";
|
||||
import { ValueObject } from "../../../shared/domain/ValueObject";
|
||||
|
||||
export interface DriverNameProps {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export class DriverName implements IValueObject<DriverNameProps> {
|
||||
export class DriverName implements ValueObject<DriverNameProps> {
|
||||
private static readonly MIN_LENGTH = 1;
|
||||
private static readonly MAX_LENGTH = 50;
|
||||
private static readonly VALID_CHARACTERS = /^[a-zA-Z0-9\s\-_]+$/;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Different sim racing games have different maximum grid sizes.
|
||||
*/
|
||||
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export interface GameConstraintsData {
|
||||
readonly maxDrivers: number;
|
||||
@@ -21,7 +21,7 @@ export interface GameConstraintsProps {
|
||||
constraints: GameConstraintsData;
|
||||
}
|
||||
|
||||
export class GameConstraints implements IValueObject<GameConstraintsProps> {
|
||||
export class GameConstraints implements ValueObject<GameConstraintsProps> {
|
||||
readonly gameId: string;
|
||||
readonly constraints: GameConstraintsData;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export class ImageUrl implements IValueObject<string> {
|
||||
export class ImageUrl implements ValueObject<string> {
|
||||
private constructor(private readonly value: string) {}
|
||||
|
||||
static create(value: string): ImageUrl {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export class JoinedAt implements IValueObject<Date> {
|
||||
export class JoinedAt implements ValueObject<Date> {
|
||||
private constructor(private readonly value: Date) {}
|
||||
|
||||
static create(value: Date): JoinedAt {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export interface LeagueDescriptionValidationResult {
|
||||
valid: boolean;
|
||||
@@ -22,7 +22,7 @@ export interface LeagueDescriptionProps {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export class LeagueDescription implements IValueObject<LeagueDescriptionProps> {
|
||||
export class LeagueDescription implements ValueObject<LeagueDescriptionProps> {
|
||||
readonly value: string;
|
||||
|
||||
private constructor(value: string) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export interface LeagueNameValidationResult {
|
||||
valid: boolean;
|
||||
@@ -27,7 +27,7 @@ export interface LeagueNameProps {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export class LeagueName implements IValueObject<LeagueNameProps> {
|
||||
export class LeagueName implements ValueObject<LeagueNameProps> {
|
||||
readonly value: string;
|
||||
|
||||
private constructor(value: string) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export interface LeagueTimezoneProps {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export class LeagueTimezone implements IValueObject<LeagueTimezoneProps> {
|
||||
export class LeagueTimezone implements ValueObject<LeagueTimezoneProps> {
|
||||
readonly id: string;
|
||||
|
||||
private constructor(id: string) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* This is a hardened version that enforces strict business rules.
|
||||
*/
|
||||
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
|
||||
export type LeagueVisibilityType = 'ranked' | 'unranked';
|
||||
@@ -39,7 +39,7 @@ export interface LeagueVisibilityProps {
|
||||
type: LeagueVisibilityType;
|
||||
}
|
||||
|
||||
export class LeagueVisibility implements IValueObject<LeagueVisibilityProps> {
|
||||
export class LeagueVisibility implements ValueObject<LeagueVisibilityProps> {
|
||||
readonly type: LeagueVisibilityType;
|
||||
readonly constraints: LeagueVisibilityConstraints;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export type DecalType = 'sponsor' | 'user';
|
||||
|
||||
@@ -20,7 +20,7 @@ export interface LiveryDecalProps {
|
||||
type: DecalType;
|
||||
}
|
||||
|
||||
export class LiveryDecal implements IValueObject<LiveryDecalProps> {
|
||||
export class LiveryDecal implements ValueObject<LiveryDecalProps> {
|
||||
readonly id: string;
|
||||
readonly imageUrl: string;
|
||||
readonly x: number;
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
* Enforces reasonable limits and constraints.
|
||||
*/
|
||||
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
|
||||
export interface MaxParticipantsProps {
|
||||
value: number;
|
||||
}
|
||||
|
||||
export class MaxParticipants implements IValueObject<MaxParticipantsProps> {
|
||||
export class MaxParticipants implements ValueObject<MaxParticipantsProps> {
|
||||
readonly value: number;
|
||||
|
||||
private constructor(value: number) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
|
||||
import type { Money } from './Money';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export type MembershipFeeType = 'season' | 'monthly' | 'per_race';
|
||||
|
||||
@@ -15,7 +15,7 @@ export interface MembershipFeeProps {
|
||||
amount: Money;
|
||||
}
|
||||
|
||||
export class MembershipFee implements IValueObject<MembershipFeeProps> {
|
||||
export class MembershipFee implements ValueObject<MembershipFeeProps> {
|
||||
readonly type: MembershipFeeType;
|
||||
readonly amount: Money;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Represents a monetary amount with currency and platform fee calculation
|
||||
*/
|
||||
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
|
||||
export type Currency = 'USD' | 'EUR' | 'GBP';
|
||||
@@ -16,7 +16,7 @@ export interface MoneyProps {
|
||||
currency: Currency;
|
||||
}
|
||||
|
||||
export class Money implements IValueObject<MoneyProps> {
|
||||
export class Money implements ValueObject<MoneyProps> {
|
||||
static readonly DEFAULT_PLATFORM_FEE_PERCENTAGE = 0.10;
|
||||
|
||||
readonly amount: number;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import { ALL_WEEKDAYS } from '../types/Weekday';
|
||||
import type { Weekday } from '../types/Weekday';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export interface MonthlyRecurrencePatternProps {
|
||||
ordinal: 1 | 2 | 3 | 4;
|
||||
weekday: Weekday;
|
||||
}
|
||||
|
||||
export class MonthlyRecurrencePattern implements IValueObject<MonthlyRecurrencePatternProps> {
|
||||
export class MonthlyRecurrencePattern implements ValueObject<MonthlyRecurrencePatternProps> {
|
||||
readonly ordinal: 1 | 2 | 3 | 4;
|
||||
readonly weekday: Weekday;
|
||||
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
* Enforces constraints based on league visibility and other business rules.
|
||||
*/
|
||||
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
|
||||
export interface ParticipantCountProps {
|
||||
value: number;
|
||||
}
|
||||
|
||||
export class ParticipantCount implements IValueObject<ParticipantCountProps> {
|
||||
export class ParticipantCount implements ValueObject<ParticipantCountProps> {
|
||||
readonly value: number;
|
||||
|
||||
private constructor(value: number) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
|
||||
export class Points implements IValueObject<{ value: number }> {
|
||||
export class Points implements ValueObject<{ value: number }> {
|
||||
private constructor(private readonly value: number) {}
|
||||
|
||||
get props(): { value: number } {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export interface PointsTableProps {
|
||||
pointsByPosition: ReadonlyMap<number, number>;
|
||||
}
|
||||
|
||||
export class PointsTable implements IValueObject<PointsTableProps> {
|
||||
export class PointsTable implements ValueObject<PointsTableProps> {
|
||||
private readonly pointsByPosition: ReadonlyMap<number, number>;
|
||||
|
||||
constructor(pointsByPosition: Record<number, number> | Map<number, number>) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
/**
|
||||
* Incident types that can occur during a race
|
||||
@@ -30,7 +30,7 @@ export interface IncidentRecord {
|
||||
* Encapsulates all incidents that occurred during a driver's race.
|
||||
* Provides methods to calculate total penalty points and incident severity.
|
||||
*/
|
||||
export class RaceIncidents implements IValueObject<IncidentRecord[]> {
|
||||
export class RaceIncidents implements ValueObject<IncidentRecord[]> {
|
||||
private readonly incidents: IncidentRecord[];
|
||||
|
||||
constructor(incidents: IncidentRecord[] = []) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export interface RaceNameProps {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export class RaceName implements IValueObject<RaceNameProps> {
|
||||
export class RaceName implements ValueObject<RaceNameProps> {
|
||||
public readonly props: RaceNameProps;
|
||||
|
||||
private constructor(value: string) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Represents the status of a race with strict lifecycle rules.
|
||||
*/
|
||||
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
|
||||
export type RaceStatusValue = 'scheduled' | 'running' | 'completed' | 'cancelled';
|
||||
@@ -13,7 +13,7 @@ export interface RaceStatusProps {
|
||||
value: RaceStatusValue;
|
||||
}
|
||||
|
||||
export class RaceStatus implements IValueObject<RaceStatusProps> {
|
||||
export class RaceStatus implements ValueObject<RaceStatusProps> {
|
||||
readonly value: RaceStatusValue;
|
||||
|
||||
private constructor(value: RaceStatusValue) {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export interface RaceTimeOfDayProps {
|
||||
hour: number;
|
||||
minute: number;
|
||||
}
|
||||
|
||||
export class RaceTimeOfDay implements IValueObject<RaceTimeOfDayProps> {
|
||||
export class RaceTimeOfDay implements ValueObject<RaceTimeOfDayProps> {
|
||||
readonly hour: number;
|
||||
readonly minute: number;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { IRacingId } from './IRacingId';
|
||||
import { RacingId } from './RacingId';
|
||||
|
||||
describe('IRacingId', () => {
|
||||
it('should create an iRacing id', () => {
|
||||
@@ -1,7 +1,7 @@
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export class IRacingId implements IValueObject<string> {
|
||||
export class IRacingId implements ValueObject<string> {
|
||||
private constructor(private readonly value: string) {}
|
||||
|
||||
static create(value: string): IRacingId {
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { WeekdaySet } from './WeekdaySet';
|
||||
import { MonthlyRecurrencePattern } from './MonthlyRecurrencePattern';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
@@ -24,7 +24,7 @@ export type RecurrenceStrategyProps =
|
||||
| EveryNWeeksRecurrenceStrategyProps
|
||||
| MonthlyNthWeekdayRecurrenceStrategyProps;
|
||||
|
||||
export class RecurrenceStrategy implements IValueObject<RecurrenceStrategyProps> {
|
||||
export class RecurrenceStrategy implements ValueObject<RecurrenceStrategyProps> {
|
||||
private constructor(private readonly strategy: RecurrenceStrategyProps) {}
|
||||
|
||||
get props(): RecurrenceStrategyProps {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { LeagueTimezone } from './LeagueTimezone';
|
||||
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export interface ScheduledRaceSlotProps {
|
||||
roundNumber: number;
|
||||
@@ -9,7 +9,7 @@ export interface ScheduledRaceSlotProps {
|
||||
timezone: LeagueTimezone;
|
||||
}
|
||||
|
||||
export class ScheduledRaceSlot implements IValueObject<ScheduledRaceSlotProps> {
|
||||
export class ScheduledRaceSlot implements ValueObject<ScheduledRaceSlotProps> {
|
||||
readonly roundNumber: number;
|
||||
readonly scheduledAt: Date;
|
||||
readonly timezone: LeagueTimezone;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export type SeasonDropStrategy = 'none' | 'bestNResults' | 'dropWorstN';
|
||||
|
||||
@@ -13,7 +13,7 @@ export interface SeasonDropPolicyProps {
|
||||
n?: number;
|
||||
}
|
||||
|
||||
export class SeasonDropPolicy implements IValueObject<SeasonDropPolicyProps> {
|
||||
export class SeasonDropPolicy implements ValueObject<SeasonDropPolicyProps> {
|
||||
readonly strategy: SeasonDropStrategy;
|
||||
readonly n?: number;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { RaceTimeOfDay } from './RaceTimeOfDay';
|
||||
import { LeagueTimezone } from './LeagueTimezone';
|
||||
import type { RecurrenceStrategy } from './RecurrenceStrategy';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export interface SeasonScheduleProps {
|
||||
startDate: Date;
|
||||
@@ -12,7 +12,7 @@ export interface SeasonScheduleProps {
|
||||
plannedRounds: number;
|
||||
}
|
||||
|
||||
export class SeasonSchedule implements IValueObject<SeasonScheduleProps> {
|
||||
export class SeasonSchedule implements ValueObject<SeasonScheduleProps> {
|
||||
readonly startDate: Date;
|
||||
readonly timeOfDay: RaceTimeOfDay;
|
||||
readonly timezone: LeagueTimezone;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user