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,14 @@
* Designed for fast, common penalty scenarios like track limits, warnings, etc.
*/
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 { RaceRepository } from '../../domain/repositories/RaceRepository';
import { LeagueMembershipRepository } from '../../domain/repositories/LeagueMembershipRepository';
export type QuickPenaltyErrorCode = 'RACE_NOT_FOUND' | 'UNAUTHORIZED' | 'UNKNOWN_INFRACTION' | 'REPOSITORY_ERROR';
@@ -55,7 +58,7 @@ export class QuickPenaltyUseCase {
// Validate admin has authority
const memberships = await this.leagueMembershipRepository.getLeagueMembers(race.leagueId);
const adminMembership = memberships.find(
m => m.driverId.toString() === input.adminId && m.status.toString() === 'active'
(m: any) => m.driverId.toString() === input.adminId && m.status.toString() === 'active'
);
if (!adminMembership || (adminMembership.role.toString() !== 'owner' && adminMembership.role.toString() !== 'admin')) {
@@ -99,7 +102,7 @@ export class QuickPenaltyUseCase {
await this.penaltyRepository.create(penalty);
const result: QuickPenaltyResult = {
penaltyId: penalty.id,
penaltyId: penalty.id.toString(),
raceId: input.raceId,
driverId: input.driverId,
type,