This commit is contained in:
2025-12-12 23:49:56 +01:00
parent cae81b1088
commit 8f1db21fb1
29 changed files with 879 additions and 399 deletions

View File

@@ -438,7 +438,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
private static readonly PAUSE_CHECK_INTERVAL = 300;
/** Checkout confirmation callback - called before clicking checkout button */
private checkoutConfirmationCallback?: (price: CheckoutPrice, state: CheckoutState) => Promise<CheckoutConfirmation>;
private checkoutConfirmationCallback: ((price: CheckoutPrice, state: CheckoutState) => Promise<CheckoutConfirmation>) | undefined;
/** Page state validator instance */
private pageStateValidator: PageStateValidator;

View File

@@ -508,7 +508,7 @@ export class IRacingDomInteractor {
for (const sel of cands) {
try {
const els = Array.from(document.querySelectorAll(sel)) as HTMLInputElement[];
const els = Array.from(document.querySelectorAll(sel)) as HTMLElement[];
if (els.length === 0) continue;
for (const el of els) {
try {
@@ -516,10 +516,10 @@ export class IRacingDomInteractor {
(el as HTMLInputElement).checked = Boolean(should);
el.dispatchEvent(new Event('change', { bubbles: true }));
} else {
(el as HTMLElement).setAttribute('aria-checked', String(Boolean(should)));
el.setAttribute('aria-checked', String(Boolean(should)));
el.dispatchEvent(new Event('change', { bubbles: true }));
try {
(el as HTMLElement).click();
el.click();
} catch {
// ignore
}
@@ -615,7 +615,7 @@ export class IRacingDomInteractor {
const applied = await page.evaluate(
({ sel, val }) => {
try {
const els = Array.from(document.querySelectorAll(sel)) as HTMLElement[];
const els = Array.from(document.querySelectorAll(sel)) as HTMLInputElement[];
if (els.length === 0) return false;
for (const el of els) {
try {

View File

@@ -67,6 +67,7 @@ export class ApplyPenaltyUseCase
// Create the penalty
const penalty = Penalty.create({
id: randomUUID(),
leagueId: race.leagueId,
raceId: command.raceId,
driverId: command.driverId,
type: command.type,

View File

@@ -23,6 +23,7 @@ export type PenaltyStatus = 'pending' | 'applied' | 'appealed' | 'overturned';
export interface PenaltyProps {
id: string;
leagueId: string;
raceId: string;
/** The driver receiving the penalty */
driverId: string;
@@ -51,6 +52,7 @@ export class Penalty implements IEntity<string> {
static create(props: PenaltyProps): Penalty {
if (!props.id) throw new RacingDomainValidationError('Penalty ID is required');
if (!props.leagueId) throw new RacingDomainValidationError('League ID is required');
if (!props.raceId) throw new RacingDomainValidationError('Race ID is required');
if (!props.driverId) throw new RacingDomainValidationError('Driver ID is required');
if (!props.type) throw new RacingDomainValidationError('Penalty type is required');
@@ -72,6 +74,7 @@ export class Penalty implements IEntity<string> {
}
get id(): string { return this.props.id; }
get leagueId(): string { return this.props.leagueId; }
get raceId(): string { return this.props.raceId; }
get driverId(): string { return this.props.driverId; }
get type(): PenaltyType { return this.props.type; }