website refactor
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
/**
|
||||
* Value Object: SeasonScoringConfig
|
||||
@@ -30,7 +30,7 @@ export interface SeasonScoringConfigProps {
|
||||
}
|
||||
|
||||
export class SeasonScoringConfig
|
||||
implements IValueObject<SeasonScoringConfigProps>
|
||||
implements ValueObject<SeasonScoringConfigProps>
|
||||
{
|
||||
readonly scoringPresetId: string;
|
||||
readonly customScoringEnabled: boolean;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Represents the status of a season 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 SeasonStatusValue = 'planned' | 'active' | 'completed' | 'archived' | 'cancelled';
|
||||
@@ -13,7 +13,7 @@ export interface SeasonStatusProps {
|
||||
value: SeasonStatusValue;
|
||||
}
|
||||
|
||||
export class SeasonStatus implements IValueObject<SeasonStatusProps> {
|
||||
export class SeasonStatus implements ValueObject<SeasonStatusProps> {
|
||||
readonly value: SeasonStatusValue;
|
||||
|
||||
private constructor(value: SeasonStatusValue) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import type { StewardingDecisionMode } from '../entities/League';
|
||||
|
||||
export interface SeasonStewardingConfigProps {
|
||||
@@ -21,7 +21,7 @@ export interface SeasonStewardingConfigProps {
|
||||
* Shape intentionally mirrors LeagueStewardingFormDTO used by the wizard.
|
||||
*/
|
||||
export class SeasonStewardingConfig
|
||||
implements IValueObject<SeasonStewardingConfigProps>
|
||||
implements ValueObject<SeasonStewardingConfigProps>
|
||||
{
|
||||
readonly decisionMode: StewardingDecisionMode;
|
||||
readonly requiredVotes?: number;
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
* Enforces reasonable limits for different session types.
|
||||
*/
|
||||
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
|
||||
export interface SessionDurationProps {
|
||||
value: number;
|
||||
}
|
||||
|
||||
export class SessionDuration implements IValueObject<SessionDurationProps> {
|
||||
export class SessionDuration implements ValueObject<SessionDurationProps> {
|
||||
readonly value: number;
|
||||
|
||||
private constructor(value: number) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
/**
|
||||
* Value Object: SessionType
|
||||
@@ -9,7 +9,7 @@ import type { IValueObject } from '@core/shared/domain';
|
||||
*/
|
||||
export type SessionTypeValue = 'practice' | 'qualifying' | 'q1' | 'q2' | 'q3' | 'sprint' | 'main' | 'timeTrial';
|
||||
|
||||
export class SessionType implements IValueObject<SessionTypeValue> {
|
||||
export class SessionType implements ValueObject<SessionTypeValue> {
|
||||
readonly value: SessionTypeValue;
|
||||
|
||||
constructor(value: SessionTypeValue) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
import { Money } from './Money';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export interface SponsorshipSlotConfig {
|
||||
tier: 'main' | 'secondary';
|
||||
@@ -23,7 +23,7 @@ export interface SponsorshipPricingProps {
|
||||
customRequirements?: string | undefined;
|
||||
}
|
||||
|
||||
export class SponsorshipPricing implements IValueObject<SponsorshipPricingProps> {
|
||||
export class SponsorshipPricing implements ValueObject<SponsorshipPricingProps> {
|
||||
readonly mainSlot: SponsorshipSlotConfig | undefined;
|
||||
readonly secondarySlots: SponsorshipSlotConfig | undefined;
|
||||
readonly acceptingApplications: boolean;
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
* Enforces valid range and provides domain-specific operations.
|
||||
*/
|
||||
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
|
||||
export interface StrengthOfFieldProps {
|
||||
value: number;
|
||||
}
|
||||
|
||||
export class StrengthOfField implements IValueObject<StrengthOfFieldProps> {
|
||||
export class StrengthOfField implements ValueObject<StrengthOfFieldProps> {
|
||||
readonly value: number;
|
||||
|
||||
private constructor(value: number) {
|
||||
|
||||
@@ -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 TeamCreatedAt implements IValueObject<Date> {
|
||||
export class TeamCreatedAt implements ValueObject<Date> {
|
||||
private constructor(private readonly value: Date) {}
|
||||
|
||||
get props(): Date {
|
||||
|
||||
@@ -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 TeamDescription implements IValueObject<string> {
|
||||
export class TeamDescription implements ValueObject<string> {
|
||||
private constructor(private readonly value: string) {}
|
||||
|
||||
get props(): string {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { TeamDrivingReasonCode, TEAM_DRIVING_REASON_CODES } from './TeamDrivingReasonCode';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
|
||||
@@ -35,8 +36,8 @@ describe('TeamDrivingReasonCode', () => {
|
||||
});
|
||||
|
||||
it('should throw error for null/undefined', () => {
|
||||
expect(() => TeamDrivingReasonCode.create(null as any)).toThrow(RacingDomainValidationError);
|
||||
expect(() => TeamDrivingReasonCode.create(undefined as any)).toThrow(RacingDomainValidationError);
|
||||
expect(() => TeamDrivingReasonCode.create(null as unknown as string)).toThrow(RacingDomainValidationError);
|
||||
expect(() => TeamDrivingReasonCode.create(undefined as unknown as string)).toThrow(RacingDomainValidationError);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
|
||||
export interface TeamDrivingReasonCodeProps {
|
||||
@@ -30,7 +30,7 @@ export type TeamDrivingReasonCodeValue = (typeof TEAM_DRIVING_REASON_CODES)[numb
|
||||
/**
|
||||
* Value object representing a team driving reason code
|
||||
*/
|
||||
export class TeamDrivingReasonCode implements IValueObject<TeamDrivingReasonCodeProps> {
|
||||
export class TeamDrivingReasonCode implements ValueObject<TeamDrivingReasonCodeProps> {
|
||||
readonly value: TeamDrivingReasonCodeValue;
|
||||
|
||||
private constructor(value: TeamDrivingReasonCodeValue) {
|
||||
|
||||
@@ -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 TeamName implements IValueObject<string> {
|
||||
export class TeamName implements ValueObject<string> {
|
||||
private constructor(private readonly value: string) {}
|
||||
|
||||
get props(): string {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
/**
|
||||
* Value Object: TeamRating
|
||||
@@ -34,7 +34,7 @@ const DEFAULT_DIMENSION: TeamRatingDimension = {
|
||||
lastUpdated: new Date(),
|
||||
};
|
||||
|
||||
export class TeamRating implements IValueObject<TeamRatingProps> {
|
||||
export class TeamRating implements ValueObject<TeamRatingProps> {
|
||||
readonly props: TeamRatingProps;
|
||||
|
||||
private constructor(props: TeamRatingProps) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
|
||||
export interface TeamRatingDeltaProps {
|
||||
value: number;
|
||||
}
|
||||
|
||||
export class TeamRatingDelta implements IValueObject<TeamRatingDeltaProps> {
|
||||
export class TeamRatingDelta implements ValueObject<TeamRatingDeltaProps> {
|
||||
readonly value: number;
|
||||
|
||||
private constructor(value: number) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
|
||||
export interface TeamRatingDimensionKeyProps {
|
||||
@@ -7,7 +7,7 @@ export interface TeamRatingDimensionKeyProps {
|
||||
|
||||
const VALID_DIMENSIONS = ['driving', 'adminTrust'] as const;
|
||||
|
||||
export class TeamRatingDimensionKey implements IValueObject<TeamRatingDimensionKeyProps> {
|
||||
export class TeamRatingDimensionKey implements ValueObject<TeamRatingDimensionKeyProps> {
|
||||
readonly value: TeamRatingDimensionKeyProps['value'];
|
||||
|
||||
private constructor(value: TeamRatingDimensionKeyProps['value']) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
|
||||
// Simple UUID v4 generator
|
||||
@@ -14,7 +14,7 @@ export interface TeamRatingEventIdProps {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export class TeamRatingEventId implements IValueObject<TeamRatingEventIdProps> {
|
||||
export class TeamRatingEventId implements ValueObject<TeamRatingEventIdProps> {
|
||||
readonly value: string;
|
||||
|
||||
private constructor(value: string) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
|
||||
export interface TeamRatingValueProps {
|
||||
value: number;
|
||||
}
|
||||
|
||||
export class TeamRatingValue implements IValueObject<TeamRatingValueProps> {
|
||||
export class TeamRatingValue implements ValueObject<TeamRatingValueProps> {
|
||||
readonly value: number;
|
||||
|
||||
private constructor(value: number) {
|
||||
|
||||
@@ -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 TeamTag implements IValueObject<string> {
|
||||
export class TeamTag implements ValueObject<string> {
|
||||
private constructor(private readonly value: string) {}
|
||||
|
||||
get props(): string {
|
||||
|
||||
@@ -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 TrackCountry implements IValueObject<string> {
|
||||
export class TrackCountry implements ValueObject<string> {
|
||||
private constructor(private readonly value: string) {}
|
||||
|
||||
get props(): string {
|
||||
|
||||
@@ -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 TrackGameId implements IValueObject<string> {
|
||||
export class TrackGameId implements ValueObject<string> {
|
||||
private constructor(private readonly value: string) {}
|
||||
|
||||
get props(): string {
|
||||
|
||||
@@ -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 TrackImageUrl implements IValueObject<string | undefined> {
|
||||
export class TrackImageUrl implements ValueObject<string | undefined> {
|
||||
private constructor(private readonly value: string | undefined) {}
|
||||
|
||||
get props(): string | undefined {
|
||||
|
||||
@@ -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 TrackLength implements IValueObject<number> {
|
||||
export class TrackLength implements ValueObject<number> {
|
||||
private constructor(private readonly value: number) {}
|
||||
|
||||
get props(): number {
|
||||
|
||||
@@ -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 TrackShortName implements IValueObject<string> {
|
||||
export class TrackShortName implements ValueObject<string> {
|
||||
private constructor(private readonly value: string) {}
|
||||
|
||||
get props(): string {
|
||||
|
||||
@@ -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 TrackTurns implements IValueObject<number> {
|
||||
export class TrackTurns implements ValueObject<number> {
|
||||
private constructor(private readonly value: number) {}
|
||||
|
||||
get props(): number {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import type { Weekday } from '../types/Weekday';
|
||||
import { weekdayToIndex } from '../types/Weekday';
|
||||
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export interface WeekdaySetProps {
|
||||
days: Weekday[];
|
||||
}
|
||||
|
||||
export class WeekdaySet implements IValueObject<WeekdaySetProps> {
|
||||
export class WeekdaySet implements ValueObject<WeekdaySetProps> {
|
||||
private readonly days: Weekday[];
|
||||
|
||||
static fromArray(days: Weekday[]): WeekdaySet {
|
||||
|
||||
@@ -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 DriverBioProps {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export class DriverBio implements IValueObject<DriverBioProps> {
|
||||
export class DriverBio implements ValueObject<DriverBioProps> {
|
||||
private constructor(private readonly value: string) {}
|
||||
|
||||
static create(value: string): DriverBio {
|
||||
|
||||
@@ -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 DriverIdProps {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export class DriverId implements IValueObject<DriverIdProps> {
|
||||
export class DriverId implements ValueObject<DriverIdProps> {
|
||||
private constructor(private readonly value: string) {}
|
||||
|
||||
static create(value: string): DriverId {
|
||||
|
||||
@@ -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 DriverNameProps {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export class DriverName implements IValueObject<DriverNameProps> {
|
||||
export class DriverName implements ValueObject<DriverNameProps> {
|
||||
private constructor(private readonly value: string) {}
|
||||
|
||||
static create(value: string): DriverName {
|
||||
|
||||
Reference in New Issue
Block a user