website refactor

This commit is contained in:
2026-01-16 18:21:06 +01:00
parent 2f53727702
commit 095885544b
146 changed files with 970 additions and 524 deletions

View File

@@ -5,11 +5,15 @@
* The penalty can be standalone or linked to an upheld protest.
*/
import { Result } from '@/shared/domain/Result';
import { Result } from '@core/shared/domain/Result';
import type { Logger } from '@core/shared/domain/Logger';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
import { randomUUID } from 'crypto';
import { Penalty } from '../../domain/entities/penalty/Penalty';
import { PenaltyRepository } from '../../domain/repositories/PenaltyRepository';
import { ProtestRepository } from '../../domain/repositories/ProtestRepository';
import { RaceRepository } from '../../domain/repositories/RaceRepository';
import { LeagueMembershipRepository } from '../../domain/repositories/LeagueMembershipRepository';
export interface ApplyPenaltyInput {
raceId: string;
@@ -62,7 +66,7 @@ export class ApplyPenaltyUseCase {
// Validate steward has authority (owner or admin of the league)
const memberships = await this.leagueMembershipRepository.getLeagueMembers(race.leagueId);
const stewardMembership = memberships.find(
m => m.driverId.toString() === command.stewardId && m.status.toString() === 'active'
(m) => m.driverId.toString() === command.stewardId && m.status.toString() === 'active'
);
if (!stewardMembership || (stewardMembership.role.toString() !== 'owner' && stewardMembership.role.toString() !== 'admin')) {
@@ -110,7 +114,7 @@ export class ApplyPenaltyUseCase {
`ApplyPenaltyUseCase: Successfully applied penalty ${penalty.id} for driver ${command.driverId} in race ${command.raceId}.`,
);
const result: ApplyPenaltyResult = { penaltyId: penalty.id };
const result: ApplyPenaltyResult = { penaltyId: penalty.id.toString() };
return Result.ok(result);
}