module creation

This commit is contained in:
2025-12-15 21:44:06 +01:00
parent b834f88bbd
commit 7c7267da72
88 changed files with 12119 additions and 4241 deletions

View File

@@ -0,0 +1,62 @@
export class ApiClient {
private baseUrl: string;
constructor(baseUrl: string) {
this.baseUrl = baseUrl;
}
private async request<T>(method: string, path: string, data?: object): Promise<T | void> {
const headers: HeadersInit = {
'Content-Type': 'application/json',
};
const config: RequestInit = {
method,
headers,
};
if (data) {
config.body = JSON.stringify(data);
}
const response = await fetch(`${this.baseUrl}${path}`, config);
if (!response.ok) {
// Attempt to read error message from response body
let errorData: any;
try {
errorData = await response.json();
} catch (e) {
errorData = { message: response.statusText };
}
throw new Error(errorData.message || `API request failed with status ${response.status}`);
}
const text = await response.text();
return text ? JSON.parse(text) : undefined;
}
get<T>(path: string): Promise<T | void> {
return this.request<T>('GET', path);
}
post<T>(path: string, data: object): Promise<T | void> {
return this.request<T>('POST', path, data);
}
put<T>(path: string, data: object): Promise<T | void> {
return this.request<T>('PUT', path, data);
}
delete<T>(path: string): Promise<T | void> {
return this.request<T>('DELETE', path);
}
patch<T>(path: string, data: object): Promise<T | void> {
return this.request<T>('PATCH', path, data);
}
}
// Instantiate the API client with your backend's base URL
// You might want to get this from an environment variable
export const api = new ApiClient(process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:3001');

View File

@@ -0,0 +1,50 @@
import { api } from '../apiClient';
import type {
AuthenticatedUserDTO,
AuthSessionDTO,
SignupParams,
LoginParams,
IracingAuthRedirectResult,
LoginWithIracingCallbackParams,
} from '../../../apps/api/src/modules/auth/dto/AuthDto'; // Using generated API DTOs
export class AuthApiClient {
async getCurrentSession(): Promise<AuthSessionDTO | null> {
try {
return await api.get<AuthSessionDTO>('/auth/session');
} catch (error) {
// Handle error, e.g., if session is not found or API is down
console.error('Error fetching current session:', error);
return null;
}
}
async signupWithEmail(params: SignupParams): Promise<AuthSessionDTO> {
return api.post<AuthSessionDTO>('/auth/signup', params);
}
async loginWithEmail(params: LoginParams): Promise<AuthSessionDTO> {
return api.post<AuthSessionDTO>('/auth/login', params);
}
async startIracingAuthRedirect(returnTo?: string): Promise<IracingAuthRedirectResult> {
const query = returnTo ? `?returnTo=${encodeURIComponent(returnTo)}` : '';
return api.get<IracingAuthRedirectResult>(`/auth/iracing/start${query}`);
}
async loginWithIracingCallback(params: LoginWithIracingCallbackParams): Promise<AuthSessionDTO> {
const query = new URLSearchParams();
query.append('code', params.code);
query.append('state', params.state);
if (params.returnTo) {
query.append('returnTo', params.returnTo);
}
return await api.get<AuthSessionDTO>(`/auth/iracing/callback?${query.toString()}`);
}
async logout(): Promise<void> {
return api.post<void>('/auth/logout', {});
}
}
export const authApiClient = new AuthApiClient();

View File

@@ -1,36 +0,0 @@
import type { AuthenticatedUserDTO } from '@gridpilot/identity/application/dto/AuthenticatedUserDTO';
import type { AuthSessionDTO } from '@gridpilot/identity/application/dto/AuthSessionDTO';
export type AuthUser = AuthenticatedUserDTO;
export type AuthSession = AuthSessionDTO;
export interface SignupParams {
email: string;
password: string;
displayName: string;
}
export interface LoginParams {
email: string;
password: string;
}
export interface AuthService {
getCurrentSession(): Promise<AuthSession | null>;
// Email/password authentication
signupWithEmail(params: SignupParams): Promise<AuthSession>;
loginWithEmail(params: LoginParams): Promise<AuthSession>;
// iRacing OAuth (demo)
startIracingAuthRedirect(
returnTo?: string,
): Promise<{ redirectUrl: string; state: string }>;
loginWithIracingCallback(params: {
code: string;
state: string;
returnTo?: string;
}): Promise<AuthSession>;
logout(): Promise<void>;
}

View File

@@ -1,14 +0,0 @@
import type { AuthService } from './AuthService';
import { InMemoryAuthService } from './InMemoryAuthService';
import { getDIContainer } from '../di-container';
import { DI_TOKENS } from '../di-tokens';
export function getAuthService(): AuthService {
const container = getDIContainer();
if (!container.isRegistered(DI_TOKENS.AuthService)) {
throw new Error(
`${DI_TOKENS.AuthService.description} not registered in DI container.`,
);
}
return container.resolve<AuthService>(DI_TOKENS.AuthService);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,982 +0,0 @@
/**
* Dependency Injection Container - TSyringe Facade
*
* Provides backward-compatible API for accessing dependencies managed by TSyringe.
*/
import { configureDIContainer, getDIContainer } from './di-config';
import { DI_TOKENS } from './di-tokens';
import { LeagueScoringPresetsPresenter } from './presenters/LeagueScoringPresetsPresenter';
import type { IDriverRepository } from '@gridpilot/racing/domain/repositories/IDriverRepository';
import type { ILeagueRepository } from '@gridpilot/racing/domain/repositories/ILeagueRepository';
import type { IRaceRepository } from '@gridpilot/racing/domain/repositories/IRaceRepository';
import type { IResultRepository } from '@gridpilot/racing/domain/repositories/IResultRepository';
import type { IStandingRepository } from '@gridpilot/racing/domain/repositories/IStandingRepository';
import type { IPenaltyRepository } from '@gridpilot/racing/domain/repositories/IPenaltyRepository';
import type { IProtestRepository } from '@gridpilot/racing/domain/repositories/IProtestRepository';
import type { IGameRepository } from '@gridpilot/racing/domain/repositories/IGameRepository';
import type { ISeasonRepository } from '@gridpilot/racing/domain/repositories/ISeasonRepository';
import type { ILeagueScoringConfigRepository } from '@gridpilot/racing/domain/repositories/ILeagueScoringConfigRepository';
import type { ITrackRepository } from '@gridpilot/racing/domain/repositories/ITrackRepository';
import type { ICarRepository } from '@gridpilot/racing/domain/repositories/ICarRepository';
import type {
ITeamRepository,
ITeamMembershipRepository,
IRaceRegistrationRepository,
} from '@gridpilot/racing';
import type { ILeagueMembershipRepository } from '@gridpilot/racing/domain/repositories/ILeagueMembershipRepository';
import type { LeagueMembership, JoinRequest } from '@gridpilot/racing/domain/entities/LeagueMembership';
import type { IFeedRepository } from '@gridpilot/social/domain/repositories/IFeedRepository';
import type { ISocialGraphRepository } from '@gridpilot/social/domain/repositories/ISocialGraphRepository';
import type { ImageServicePort } from '@gridpilot/media';
// Notifications package imports
import type { INotificationRepository, INotificationPreferenceRepository } from '@gridpilot/notifications/application';
import type {
SendNotificationUseCase,
MarkNotificationReadUseCase,
GetUnreadNotificationsUseCase
} from '@gridpilot/notifications/application';
import type {
JoinLeagueUseCase,
RegisterForRaceUseCase,
WithdrawFromRaceUseCase,
CreateTeamUseCase,
JoinTeamUseCase,
LeaveTeamUseCase,
ApproveTeamJoinRequestUseCase,
RejectTeamJoinRequestUseCase,
UpdateTeamUseCase,
GetAllTeamsUseCase,
GetTeamDetailsUseCase,
GetTeamMembersUseCase,
GetTeamJoinRequestsUseCase,
GetDriverTeamUseCase,
CreateLeagueWithSeasonAndScoringUseCase,
FileProtestUseCase,
ReviewProtestUseCase,
ApplyPenaltyUseCase,
QuickPenaltyUseCase,
RequestProtestDefenseUseCase,
SubmitProtestDefenseUseCase,
GetSponsorDashboardUseCase,
GetSponsorSponsorshipsUseCase,
ApplyForSponsorshipUseCase,
AcceptSponsorshipRequestUseCase,
RejectSponsorshipRequestUseCase,
GetPendingSponsorshipRequestsUseCase,
GetEntitySponsorshipPricingUseCase,
} from '@gridpilot/racing/application';
import type { IsDriverRegisteredForRaceUseCase } from '@gridpilot/racing/application/use-cases/IsDriverRegisteredForRaceUseCase';
import type { GetRaceRegistrationsUseCase } from '@gridpilot/racing/application/use-cases/GetRaceRegistrationsUseCase';
import type { GetRaceWithSOFUseCase } from '@gridpilot/racing/application/use-cases/GetRaceWithSOFUseCase';
import type { GetRaceProtestsUseCase } from '@gridpilot/racing/application/use-cases/GetRaceProtestsUseCase';
import type { GetRacePenaltiesUseCase } from '@gridpilot/racing/application/use-cases/GetRacePenaltiesUseCase';
import type { GetRacesPageDataUseCase } from '@gridpilot/racing/application/use-cases/GetRacesPageDataUseCase';
import type { GetRaceDetailUseCase } from '@gridpilot/racing/application/use-cases/GetRaceDetailUseCase';
import type { GetRaceResultsDetailUseCase } from '@gridpilot/racing/application/use-cases/GetRaceResultsDetailUseCase';
import type { GetAllRacesPageDataUseCase } from '@gridpilot/racing/application/use-cases/GetAllRacesPageDataUseCase';
import type { GetProfileOverviewUseCase } from '@gridpilot/racing/application/use-cases/GetProfileOverviewUseCase';
import type { UpdateDriverProfileUseCase } from '@gridpilot/racing/application/use-cases/UpdateDriverProfileUseCase';
import type { GetDriversLeaderboardUseCase } from '@gridpilot/racing/application/use-cases/GetDriversLeaderboardUseCase';
import type { GetTeamsLeaderboardUseCase } from '@gridpilot/racing/application/use-cases/GetTeamsLeaderboardUseCase';
import type { GetLeagueStandingsUseCase } from '@gridpilot/racing/application/use-cases/GetLeagueStandingsUseCase';
import type { GetLeagueDriverSeasonStatsUseCase } from '@gridpilot/racing/application/use-cases/GetLeagueDriverSeasonStatsUseCase';
import type { GetAllLeaguesWithCapacityUseCase } from '@gridpilot/racing/application/use-cases/GetAllLeaguesWithCapacityUseCase';
import type { GetAllLeaguesWithCapacityAndScoringUseCase } from '@gridpilot/racing/application/use-cases/GetAllLeaguesWithCapacityAndScoringUseCase';
import type { ListLeagueScoringPresetsUseCase } from '@gridpilot/racing/application/use-cases/ListLeagueScoringPresetsUseCase';
import type { GetLeagueScoringConfigUseCase } from '@gridpilot/racing/application/use-cases/GetLeagueScoringConfigUseCase';
import type { GetLeagueFullConfigUseCase } from '@gridpilot/racing/application/use-cases/GetLeagueFullConfigUseCase';
import type { GetLeagueStatsUseCase } from '@gridpilot/racing/application/use-cases/GetLeagueStatsUseCase';
import type { CancelRaceUseCase } from '@gridpilot/racing/application/use-cases/CancelRaceUseCase';
import type { ImportRaceResultsUseCase } from '@gridpilot/racing/application/use-cases/ImportRaceResultsUseCase';
import type { ISponsorRepository } from '@gridpilot/racing/domain/repositories/ISponsorRepository';
import type { ISeasonSponsorshipRepository } from '@gridpilot/racing/domain/repositories/ISeasonSponsorshipRepository';
import type { ISponsorshipRequestRepository } from '@gridpilot/racing/domain/repositories/ISponsorshipRequestRepository';
import type { ISponsorshipPricingRepository } from '@gridpilot/racing/domain/repositories/ISponsorshipPricingRepository';
import type { TransferLeagueOwnershipUseCase } from '@gridpilot/racing/application/use-cases/TransferLeagueOwnershipUseCase';
import type { DriverRatingProvider } from '@gridpilot/racing/application';
import type { PreviewLeagueScheduleUseCase } from '@gridpilot/racing/application';
import type { LeagueScoringPresetProvider } from '@gridpilot/racing/application/ports/LeagueScoringPresetProvider';
import type { LeagueScoringPresetDTO } from '@gridpilot/racing/application/ports/LeagueScoringPresetProvider';
import type { GetDashboardOverviewUseCase } from '@gridpilot/racing/application/use-cases/GetDashboardOverviewUseCase';
import type { ListSeasonsForLeagueUseCase } from '@gridpilot/racing/application/use-cases/SeasonUseCases';
import { createDemoDriverStats, getDemoLeagueRankings, type DriverStats } from '@gridpilot/testing-support';
/**
* DI Container - TSyringe Facade
* Provides singleton access to TSyringe container with lazy initialization
*/
class DIContainer {
private static instance: DIContainer;
private initialized = false;
private constructor() {
// Private constructor for singleton pattern
}
/**
* Ensure TSyringe container is configured
*/
private ensureInitialized(): void {
if (this.initialized) return;
configureDIContainer();
this.initialized = true;
}
/**
* Get singleton instance
*/
static getInstance(): DIContainer {
if (!DIContainer.instance) {
DIContainer.instance = new DIContainer();
}
return DIContainer.instance;
}
/**
* Reset the container (useful for testing)
*/
static reset(): void {
DIContainer.instance = new DIContainer();
DIContainer.instance.initialized = false;
}
/**
* Repository getters - resolve from TSyringe container
*/
get driverRepository(): IDriverRepository {
this.ensureInitialized();
return getDIContainer().resolve<IDriverRepository>(DI_TOKENS.DriverRepository);
}
get leagueRepository(): ILeagueRepository {
this.ensureInitialized();
return getDIContainer().resolve<ILeagueRepository>(DI_TOKENS.LeagueRepository);
}
get raceRepository(): IRaceRepository {
this.ensureInitialized();
return getDIContainer().resolve<IRaceRepository>(DI_TOKENS.RaceRepository);
}
get resultRepository(): IResultRepository {
this.ensureInitialized();
return getDIContainer().resolve<IResultRepository>(DI_TOKENS.ResultRepository);
}
get standingRepository(): IStandingRepository {
this.ensureInitialized();
return getDIContainer().resolve<IStandingRepository>(DI_TOKENS.StandingRepository);
}
get penaltyRepository(): IPenaltyRepository {
this.ensureInitialized();
return getDIContainer().resolve<IPenaltyRepository>(DI_TOKENS.PenaltyRepository);
}
get protestRepository(): IProtestRepository {
this.ensureInitialized();
return getDIContainer().resolve<IProtestRepository>(DI_TOKENS.ProtestRepository);
}
get raceRegistrationRepository(): IRaceRegistrationRepository {
this.ensureInitialized();
return getDIContainer().resolve<IRaceRegistrationRepository>(DI_TOKENS.RaceRegistrationRepository);
}
get leagueMembershipRepository(): ILeagueMembershipRepository {
this.ensureInitialized();
return getDIContainer().resolve<ILeagueMembershipRepository>(DI_TOKENS.LeagueMembershipRepository);
}
get gameRepository(): IGameRepository {
this.ensureInitialized();
return getDIContainer().resolve<IGameRepository>(DI_TOKENS.GameRepository);
}
get seasonRepository(): ISeasonRepository {
this.ensureInitialized();
return getDIContainer().resolve<ISeasonRepository>(DI_TOKENS.SeasonRepository);
}
get leagueScoringConfigRepository(): ILeagueScoringConfigRepository {
this.ensureInitialized();
return getDIContainer().resolve<ILeagueScoringConfigRepository>(DI_TOKENS.LeagueScoringConfigRepository);
}
get leagueScoringPresetProvider(): LeagueScoringPresetProvider {
this.ensureInitialized();
return getDIContainer().resolve<LeagueScoringPresetProvider>(DI_TOKENS.LeagueScoringPresetProvider);
}
get joinLeagueUseCase(): JoinLeagueUseCase {
this.ensureInitialized();
return getDIContainer().resolve<JoinLeagueUseCase>(DI_TOKENS.JoinLeagueUseCase);
}
get registerForRaceUseCase(): RegisterForRaceUseCase {
this.ensureInitialized();
return getDIContainer().resolve<RegisterForRaceUseCase>(DI_TOKENS.RegisterForRaceUseCase);
}
get withdrawFromRaceUseCase(): WithdrawFromRaceUseCase {
this.ensureInitialized();
return getDIContainer().resolve<WithdrawFromRaceUseCase>(DI_TOKENS.WithdrawFromRaceUseCase);
}
get isDriverRegisteredForRaceUseCase(): IsDriverRegisteredForRaceUseCase {
this.ensureInitialized();
return getDIContainer().resolve<IsDriverRegisteredForRaceUseCase>(DI_TOKENS.IsDriverRegisteredForRaceUseCase);
}
get getRaceRegistrationsUseCase(): GetRaceRegistrationsUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetRaceRegistrationsUseCase>(DI_TOKENS.GetRaceRegistrationsUseCase);
}
get getLeagueStandingsUseCase(): GetLeagueStandingsUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetLeagueStandingsUseCase>(DI_TOKENS.GetLeagueStandingsUseCase);
}
get getLeagueDriverSeasonStatsUseCase(): GetLeagueDriverSeasonStatsUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetLeagueDriverSeasonStatsUseCase>(DI_TOKENS.GetLeagueDriverSeasonStatsUseCase);
}
get getAllLeaguesWithCapacityUseCase(): GetAllLeaguesWithCapacityUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetAllLeaguesWithCapacityUseCase>(DI_TOKENS.GetAllLeaguesWithCapacityUseCase);
}
get getAllLeaguesWithCapacityAndScoringUseCase(): GetAllLeaguesWithCapacityAndScoringUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetAllLeaguesWithCapacityAndScoringUseCase>(DI_TOKENS.GetAllLeaguesWithCapacityAndScoringUseCase);
}
get listSeasonsForLeagueUseCase(): ListSeasonsForLeagueUseCase {
this.ensureInitialized();
return getDIContainer().resolve<ListSeasonsForLeagueUseCase>(DI_TOKENS.ListSeasonsForLeagueUseCase);
}
get listLeagueScoringPresetsUseCase(): ListLeagueScoringPresetsUseCase {
this.ensureInitialized();
return getDIContainer().resolve<ListLeagueScoringPresetsUseCase>(DI_TOKENS.ListLeagueScoringPresetsUseCase);
}
get getLeagueScoringConfigUseCase(): GetLeagueScoringConfigUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetLeagueScoringConfigUseCase>(DI_TOKENS.GetLeagueScoringConfigUseCase);
}
get getLeagueFullConfigUseCase(): GetLeagueFullConfigUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetLeagueFullConfigUseCase>(DI_TOKENS.GetLeagueFullConfigUseCase);
}
get previewLeagueScheduleUseCase(): PreviewLeagueScheduleUseCase {
this.ensureInitialized();
return getDIContainer().resolve<PreviewLeagueScheduleUseCase>(DI_TOKENS.PreviewLeagueScheduleUseCase);
}
get getRaceWithSOFUseCase(): GetRaceWithSOFUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetRaceWithSOFUseCase>(DI_TOKENS.GetRaceWithSOFUseCase);
}
get getLeagueStatsUseCase(): GetLeagueStatsUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetLeagueStatsUseCase>(DI_TOKENS.GetLeagueStatsUseCase);
}
get getRacesPageDataUseCase(): GetRacesPageDataUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetRacesPageDataUseCase>(DI_TOKENS.GetRacesPageDataUseCase);
}
get getAllRacesPageDataUseCase(): GetAllRacesPageDataUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetAllRacesPageDataUseCase>(DI_TOKENS.GetAllRacesPageDataUseCase);
}
get getRaceDetailUseCase(): GetRaceDetailUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetRaceDetailUseCase>(DI_TOKENS.GetRaceDetailUseCase);
}
get getRaceResultsDetailUseCase(): GetRaceResultsDetailUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetRaceResultsDetailUseCase>(DI_TOKENS.GetRaceResultsDetailUseCase);
}
get getDriversLeaderboardUseCase(): GetDriversLeaderboardUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetDriversLeaderboardUseCase>(DI_TOKENS.GetDriversLeaderboardUseCase);
}
get getTeamsLeaderboardUseCase(): GetTeamsLeaderboardUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetTeamsLeaderboardUseCase>(DI_TOKENS.GetTeamsLeaderboardUseCase);
}
get getDashboardOverviewUseCase(): GetDashboardOverviewUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetDashboardOverviewUseCase>(DI_TOKENS.GetDashboardOverviewUseCase);
}
get getProfileOverviewUseCase(): GetProfileOverviewUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetProfileOverviewUseCase>(DI_TOKENS.GetProfileOverviewUseCase);
}
get updateDriverProfileUseCase(): UpdateDriverProfileUseCase {
this.ensureInitialized();
return getDIContainer().resolve<UpdateDriverProfileUseCase>(DI_TOKENS.UpdateDriverProfileUseCase);
}
get driverRatingProvider(): DriverRatingProvider {
this.ensureInitialized();
return getDIContainer().resolve<DriverRatingProvider>(DI_TOKENS.DriverRatingProvider);
}
get cancelRaceUseCase(): CancelRaceUseCase {
this.ensureInitialized();
return getDIContainer().resolve<CancelRaceUseCase>(DI_TOKENS.CancelRaceUseCase);
}
get completeRaceUseCase(): import('@gridpilot/racing/application/use-cases/CompleteRaceUseCase').CompleteRaceUseCase {
this.ensureInitialized();
return getDIContainer().resolve<import('@gridpilot/racing/application/use-cases/CompleteRaceUseCase').CompleteRaceUseCase>(DI_TOKENS.CompleteRaceUseCase);
}
get importRaceResultsUseCase(): ImportRaceResultsUseCase {
this.ensureInitialized();
return getDIContainer().resolve<ImportRaceResultsUseCase>(DI_TOKENS.ImportRaceResultsUseCase);
}
get createLeagueWithSeasonAndScoringUseCase(): CreateLeagueWithSeasonAndScoringUseCase {
this.ensureInitialized();
return getDIContainer().resolve<CreateLeagueWithSeasonAndScoringUseCase>(DI_TOKENS.CreateLeagueWithSeasonAndScoringUseCase);
}
get createTeamUseCase(): CreateTeamUseCase {
this.ensureInitialized();
return getDIContainer().resolve<CreateTeamUseCase>(DI_TOKENS.CreateTeamUseCase);
}
get joinTeamUseCase(): JoinTeamUseCase {
this.ensureInitialized();
return getDIContainer().resolve<JoinTeamUseCase>(DI_TOKENS.JoinTeamUseCase);
}
get leaveTeamUseCase(): LeaveTeamUseCase {
this.ensureInitialized();
return getDIContainer().resolve<LeaveTeamUseCase>(DI_TOKENS.LeaveTeamUseCase);
}
get approveTeamJoinRequestUseCase(): ApproveTeamJoinRequestUseCase {
this.ensureInitialized();
return getDIContainer().resolve<ApproveTeamJoinRequestUseCase>(DI_TOKENS.ApproveTeamJoinRequestUseCase);
}
get rejectTeamJoinRequestUseCase(): RejectTeamJoinRequestUseCase {
this.ensureInitialized();
return getDIContainer().resolve<RejectTeamJoinRequestUseCase>(DI_TOKENS.RejectTeamJoinRequestUseCase);
}
get updateTeamUseCase(): UpdateTeamUseCase {
this.ensureInitialized();
return getDIContainer().resolve<UpdateTeamUseCase>(DI_TOKENS.UpdateTeamUseCase);
}
get getAllTeamsUseCase(): GetAllTeamsUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetAllTeamsUseCase>(DI_TOKENS.GetAllTeamsUseCase);
}
get getTeamDetailsUseCase(): GetTeamDetailsUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetTeamDetailsUseCase>(DI_TOKENS.GetTeamDetailsUseCase);
}
get getTeamMembersUseCase(): GetTeamMembersUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetTeamMembersUseCase>(DI_TOKENS.GetTeamMembersUseCase);
}
get getTeamJoinRequestsUseCase(): GetTeamJoinRequestsUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetTeamJoinRequestsUseCase>(DI_TOKENS.GetTeamJoinRequestsUseCase);
}
get getDriverTeamUseCase(): GetDriverTeamUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetDriverTeamUseCase>(DI_TOKENS.GetDriverTeamUseCase);
}
get teamRepository(): ITeamRepository {
this.ensureInitialized();
return getDIContainer().resolve<ITeamRepository>(DI_TOKENS.TeamRepository);
}
get teamMembershipRepository(): ITeamMembershipRepository {
this.ensureInitialized();
return getDIContainer().resolve<ITeamMembershipRepository>(DI_TOKENS.TeamMembershipRepository);
}
get feedRepository(): IFeedRepository {
this.ensureInitialized();
return getDIContainer().resolve<IFeedRepository>(DI_TOKENS.FeedRepository);
}
get socialRepository(): ISocialGraphRepository {
this.ensureInitialized();
return getDIContainer().resolve<ISocialGraphRepository>(DI_TOKENS.SocialRepository);
}
get imageService(): ImageServicePort {
this.ensureInitialized();
return getDIContainer().resolve<ImageServicePort>(DI_TOKENS.ImageService);
}
get trackRepository(): ITrackRepository {
this.ensureInitialized();
return getDIContainer().resolve<ITrackRepository>(DI_TOKENS.TrackRepository);
}
get carRepository(): ICarRepository {
this.ensureInitialized();
return getDIContainer().resolve<ICarRepository>(DI_TOKENS.CarRepository);
}
get notificationRepository(): INotificationRepository {
this.ensureInitialized();
return getDIContainer().resolve<INotificationRepository>(DI_TOKENS.NotificationRepository);
}
get notificationPreferenceRepository(): INotificationPreferenceRepository {
this.ensureInitialized();
return getDIContainer().resolve<INotificationPreferenceRepository>(DI_TOKENS.NotificationPreferenceRepository);
}
get sendNotificationUseCase(): SendNotificationUseCase {
this.ensureInitialized();
return getDIContainer().resolve<SendNotificationUseCase>(DI_TOKENS.SendNotificationUseCase);
}
get markNotificationReadUseCase(): MarkNotificationReadUseCase {
this.ensureInitialized();
return getDIContainer().resolve<MarkNotificationReadUseCase>(DI_TOKENS.MarkNotificationReadUseCase);
}
get getUnreadNotificationsUseCase(): GetUnreadNotificationsUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetUnreadNotificationsUseCase>(DI_TOKENS.GetUnreadNotificationsUseCase);
}
get fileProtestUseCase(): FileProtestUseCase {
this.ensureInitialized();
return getDIContainer().resolve<FileProtestUseCase>(DI_TOKENS.FileProtestUseCase);
}
get reviewProtestUseCase(): ReviewProtestUseCase {
this.ensureInitialized();
return getDIContainer().resolve<ReviewProtestUseCase>(DI_TOKENS.ReviewProtestUseCase);
}
get applyPenaltyUseCase(): ApplyPenaltyUseCase {
this.ensureInitialized();
return getDIContainer().resolve<ApplyPenaltyUseCase>(DI_TOKENS.ApplyPenaltyUseCase);
}
get quickPenaltyUseCase(): QuickPenaltyUseCase {
this.ensureInitialized();
return getDIContainer().resolve<QuickPenaltyUseCase>(DI_TOKENS.QuickPenaltyUseCase);
}
get getRaceProtestsUseCase(): GetRaceProtestsUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetRaceProtestsUseCase>(DI_TOKENS.GetRaceProtestsUseCase);
}
get getRacePenaltiesUseCase(): GetRacePenaltiesUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetRacePenaltiesUseCase>(DI_TOKENS.GetRacePenaltiesUseCase);
}
get requestProtestDefenseUseCase(): RequestProtestDefenseUseCase {
this.ensureInitialized();
return getDIContainer().resolve<RequestProtestDefenseUseCase>(DI_TOKENS.RequestProtestDefenseUseCase);
}
get submitProtestDefenseUseCase(): SubmitProtestDefenseUseCase {
this.ensureInitialized();
return getDIContainer().resolve<SubmitProtestDefenseUseCase>(DI_TOKENS.SubmitProtestDefenseUseCase);
}
get transferLeagueOwnershipUseCase(): TransferLeagueOwnershipUseCase {
this.ensureInitialized();
return getDIContainer().resolve<TransferLeagueOwnershipUseCase>(DI_TOKENS.TransferLeagueOwnershipUseCase);
}
get sponsorRepository(): ISponsorRepository {
this.ensureInitialized();
return getDIContainer().resolve<ISponsorRepository>(DI_TOKENS.SponsorRepository);
}
get seasonSponsorshipRepository(): ISeasonSponsorshipRepository {
this.ensureInitialized();
return getDIContainer().resolve<ISeasonSponsorshipRepository>(DI_TOKENS.SeasonSponsorshipRepository);
}
get getSponsorDashboardUseCase(): GetSponsorDashboardUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetSponsorDashboardUseCase>(DI_TOKENS.GetSponsorDashboardUseCase);
}
get getSponsorSponsorshipsUseCase(): GetSponsorSponsorshipsUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetSponsorSponsorshipsUseCase>(DI_TOKENS.GetSponsorSponsorshipsUseCase);
}
get sponsorshipRequestRepository(): ISponsorshipRequestRepository {
this.ensureInitialized();
return getDIContainer().resolve<ISponsorshipRequestRepository>(DI_TOKENS.SponsorshipRequestRepository);
}
get sponsorshipPricingRepository(): ISponsorshipPricingRepository {
this.ensureInitialized();
return getDIContainer().resolve<ISponsorshipPricingRepository>(DI_TOKENS.SponsorshipPricingRepository);
}
get applyForSponsorshipUseCase(): ApplyForSponsorshipUseCase {
this.ensureInitialized();
return getDIContainer().resolve<ApplyForSponsorshipUseCase>(DI_TOKENS.ApplyForSponsorshipUseCase);
}
get acceptSponsorshipRequestUseCase(): AcceptSponsorshipRequestUseCase {
this.ensureInitialized();
return getDIContainer().resolve<AcceptSponsorshipRequestUseCase>(DI_TOKENS.AcceptSponsorshipRequestUseCase);
}
get rejectSponsorshipRequestUseCase(): RejectSponsorshipRequestUseCase {
this.ensureInitialized();
return getDIContainer().resolve<RejectSponsorshipRequestUseCase>(DI_TOKENS.RejectSponsorshipRequestUseCase);
}
get getPendingSponsorshipRequestsUseCase(): GetPendingSponsorshipRequestsUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetPendingSponsorshipRequestsUseCase>(DI_TOKENS.GetPendingSponsorshipRequestsUseCase);
}
get getEntitySponsorshipPricingUseCase(): GetEntitySponsorshipPricingUseCase {
this.ensureInitialized();
return getDIContainer().resolve<GetEntitySponsorshipPricingUseCase>(DI_TOKENS.GetEntitySponsorshipPricingUseCase);
}
}
/**
* Exported accessor functions
*/
export function getDriverRepository(): IDriverRepository {
return DIContainer.getInstance().driverRepository;
}
export function getLeagueRepository(): ILeagueRepository {
return DIContainer.getInstance().leagueRepository;
}
export function getRaceRepository(): IRaceRepository {
return DIContainer.getInstance().raceRepository;
}
export function getResultRepository(): IResultRepository {
return DIContainer.getInstance().resultRepository;
}
export function getStandingRepository(): IStandingRepository {
return DIContainer.getInstance().standingRepository;
}
export function getPenaltyRepository(): IPenaltyRepository {
return DIContainer.getInstance().penaltyRepository;
}
export function getProtestRepository(): IProtestRepository {
return DIContainer.getInstance().protestRepository;
}
export function getRaceRegistrationRepository(): IRaceRegistrationRepository {
return DIContainer.getInstance().raceRegistrationRepository;
}
export function getLeagueMembershipRepository(): ILeagueMembershipRepository {
return DIContainer.getInstance().leagueMembershipRepository;
}
export function getJoinLeagueUseCase(): JoinLeagueUseCase {
return DIContainer.getInstance().joinLeagueUseCase;
}
export function getRegisterForRaceUseCase(): RegisterForRaceUseCase {
return DIContainer.getInstance().registerForRaceUseCase;
}
export function getWithdrawFromRaceUseCase(): WithdrawFromRaceUseCase {
return DIContainer.getInstance().withdrawFromRaceUseCase;
}
export function getIsDriverRegisteredForRaceUseCase(): IsDriverRegisteredForRaceUseCase {
return DIContainer.getInstance().isDriverRegisteredForRaceUseCase;
}
/**
* Query facade for checking if a driver is registered for a race.
*/
export function getIsDriverRegisteredForRaceQuery(): {
execute(input: { raceId: string; driverId: string }): Promise<boolean>;
} {
const useCase = DIContainer.getInstance().isDriverRegisteredForRaceUseCase;
return {
async execute(input: { raceId: string; driverId: string }): Promise<boolean> {
const result = await useCase.execute(input);
return Boolean(result);
},
};
}
export function getGetRaceRegistrationsUseCase(): GetRaceRegistrationsUseCase {
return DIContainer.getInstance().getRaceRegistrationsUseCase;
}
export function getGetLeagueStandingsUseCase(): GetLeagueStandingsUseCase {
return DIContainer.getInstance().getLeagueStandingsUseCase;
}
export function getGetLeagueDriverSeasonStatsUseCase(): GetLeagueDriverSeasonStatsUseCase {
return DIContainer.getInstance().getLeagueDriverSeasonStatsUseCase;
}
export function getGetAllLeaguesWithCapacityUseCase(): GetAllLeaguesWithCapacityUseCase {
return DIContainer.getInstance().getAllLeaguesWithCapacityUseCase;
}
export function getGetAllLeaguesWithCapacityAndScoringUseCase(): GetAllLeaguesWithCapacityAndScoringUseCase {
return DIContainer.getInstance().getAllLeaguesWithCapacityAndScoringUseCase;
}
export function getListSeasonsForLeagueUseCase(): ListSeasonsForLeagueUseCase {
return DIContainer.getInstance().listSeasonsForLeagueUseCase;
}
export function getGetLeagueScoringConfigUseCase(): GetLeagueScoringConfigUseCase {
return DIContainer.getInstance().getLeagueScoringConfigUseCase;
}
export function getGetLeagueFullConfigUseCase(): GetLeagueFullConfigUseCase {
return DIContainer.getInstance().getLeagueFullConfigUseCase;
}
export function getPreviewLeagueScheduleUseCase(): PreviewLeagueScheduleUseCase {
return DIContainer.getInstance().previewLeagueScheduleUseCase;
}
export function getListLeagueScoringPresetsUseCase(): ListLeagueScoringPresetsUseCase {
return DIContainer.getInstance().listLeagueScoringPresetsUseCase;
}
/**
* Lightweight query facade for listing league scoring presets.
* Returns an object with an execute() method for use in UI code.
*/
export function getListLeagueScoringPresetsQuery(): {
execute(): Promise<LeagueScoringPresetDTO[]>;
} {
const useCase = DIContainer.getInstance().listLeagueScoringPresetsUseCase;
return {
async execute(): Promise<LeagueScoringPresetDTO[]> {
const presenter = new LeagueScoringPresetsPresenter();
await useCase.execute(undefined as void, presenter);
const viewModel = presenter.getViewModel();
return viewModel.presets;
},
};
}
export function getCreateLeagueWithSeasonAndScoringUseCase(): CreateLeagueWithSeasonAndScoringUseCase {
return DIContainer.getInstance().createLeagueWithSeasonAndScoringUseCase;
}
export function getCancelRaceUseCase(): CancelRaceUseCase {
return DIContainer.getInstance().cancelRaceUseCase;
}
export function getCompleteRaceUseCase(): import('@gridpilot/racing/application/use-cases/CompleteRaceUseCase').CompleteRaceUseCase {
return DIContainer.getInstance().completeRaceUseCase;
}
export function getImportRaceResultsUseCase(): ImportRaceResultsUseCase {
return DIContainer.getInstance().importRaceResultsUseCase;
}
export function getGetRaceWithSOFUseCase(): GetRaceWithSOFUseCase {
return DIContainer.getInstance().getRaceWithSOFUseCase;
}
export function getGetLeagueStatsUseCase(): GetLeagueStatsUseCase {
return DIContainer.getInstance().getLeagueStatsUseCase;
}
export function getGetRacesPageDataUseCase(): GetRacesPageDataUseCase {
return DIContainer.getInstance().getRacesPageDataUseCase;
}
export function getGetAllRacesPageDataUseCase(): GetAllRacesPageDataUseCase {
return DIContainer.getInstance().getAllRacesPageDataUseCase;
}
export function getGetRaceDetailUseCase(): GetRaceDetailUseCase {
return DIContainer.getInstance().getRaceDetailUseCase;
}
export function getGetRaceResultsDetailUseCase(): GetRaceResultsDetailUseCase {
return DIContainer.getInstance().getRaceResultsDetailUseCase;
}
export function getGetDriversLeaderboardUseCase(): GetDriversLeaderboardUseCase {
return DIContainer.getInstance().getDriversLeaderboardUseCase;
}
export function getGetTeamsLeaderboardUseCase(): GetTeamsLeaderboardUseCase {
return DIContainer.getInstance().getTeamsLeaderboardUseCase;
}
export function getGetDashboardOverviewUseCase(): GetDashboardOverviewUseCase {
return DIContainer.getInstance().getDashboardOverviewUseCase;
}
export function getGetProfileOverviewUseCase(): GetProfileOverviewUseCase {
return DIContainer.getInstance().getProfileOverviewUseCase;
}
export function getUpdateDriverProfileUseCase(): UpdateDriverProfileUseCase {
return DIContainer.getInstance().updateDriverProfileUseCase;
}
export function getDriverRatingProvider(): DriverRatingProvider {
return DIContainer.getInstance().driverRatingProvider;
}
export function getTeamRepository(): ITeamRepository {
return DIContainer.getInstance().teamRepository;
}
export function getTeamMembershipRepository(): ITeamMembershipRepository {
return DIContainer.getInstance().teamMembershipRepository;
}
export function getCreateTeamUseCase(): CreateTeamUseCase {
return DIContainer.getInstance().createTeamUseCase;
}
export function getJoinTeamUseCase(): JoinTeamUseCase {
return DIContainer.getInstance().joinTeamUseCase;
}
export function getLeaveTeamUseCase(): LeaveTeamUseCase {
return DIContainer.getInstance().leaveTeamUseCase;
}
export function getApproveTeamJoinRequestUseCase(): ApproveTeamJoinRequestUseCase {
return DIContainer.getInstance().approveTeamJoinRequestUseCase;
}
export function getRejectTeamJoinRequestUseCase(): RejectTeamJoinRequestUseCase {
return DIContainer.getInstance().rejectTeamJoinRequestUseCase;
}
export function getUpdateTeamUseCase(): UpdateTeamUseCase {
return DIContainer.getInstance().updateTeamUseCase;
}
export function getGetAllTeamsUseCase(): GetAllTeamsUseCase {
return DIContainer.getInstance().getAllTeamsUseCase;
}
export function getGetTeamDetailsUseCase(): GetTeamDetailsUseCase {
return DIContainer.getInstance().getTeamDetailsUseCase;
}
export function getGetTeamMembersUseCase(): GetTeamMembersUseCase {
return DIContainer.getInstance().getTeamMembersUseCase;
}
export function getGetTeamJoinRequestsUseCase(): GetTeamJoinRequestsUseCase {
return DIContainer.getInstance().getTeamJoinRequestsUseCase;
}
export function getGetDriverTeamUseCase(): GetDriverTeamUseCase {
return DIContainer.getInstance().getDriverTeamUseCase;
}
export function getFeedRepository(): IFeedRepository {
return DIContainer.getInstance().feedRepository;
}
export function getSocialRepository(): ISocialGraphRepository {
return DIContainer.getInstance().socialRepository;
}
export function getImageService(): ImageServicePort {
return DIContainer.getInstance().imageService;
}
export function getTrackRepository(): ITrackRepository {
return DIContainer.getInstance().trackRepository;
}
export function getCarRepository(): ICarRepository {
return DIContainer.getInstance().carRepository;
}
export function getSeasonRepository(): ISeasonRepository {
return DIContainer.getInstance().seasonRepository;
}
export function getNotificationRepository(): INotificationRepository {
return DIContainer.getInstance().notificationRepository;
}
export function getNotificationPreferenceRepository(): INotificationPreferenceRepository {
return DIContainer.getInstance().notificationPreferenceRepository;
}
export function getSendNotificationUseCase(): SendNotificationUseCase {
return DIContainer.getInstance().sendNotificationUseCase;
}
export function getMarkNotificationReadUseCase(): MarkNotificationReadUseCase {
return DIContainer.getInstance().markNotificationReadUseCase;
}
export function getGetUnreadNotificationsUseCase(): GetUnreadNotificationsUseCase {
return DIContainer.getInstance().getUnreadNotificationsUseCase;
}
export function getFileProtestUseCase(): FileProtestUseCase {
return DIContainer.getInstance().fileProtestUseCase;
}
export function getReviewProtestUseCase(): ReviewProtestUseCase {
return DIContainer.getInstance().reviewProtestUseCase;
}
export function getApplyPenaltyUseCase(): ApplyPenaltyUseCase {
return DIContainer.getInstance().applyPenaltyUseCase;
}
export function getQuickPenaltyUseCase(): QuickPenaltyUseCase {
return DIContainer.getInstance().quickPenaltyUseCase;
}
export function getGetRaceProtestsUseCase(): GetRaceProtestsUseCase {
return DIContainer.getInstance().getRaceProtestsUseCase;
}
export function getGetRacePenaltiesUseCase(): GetRacePenaltiesUseCase {
return DIContainer.getInstance().getRacePenaltiesUseCase;
}
export function getRequestProtestDefenseUseCase(): RequestProtestDefenseUseCase {
return DIContainer.getInstance().requestProtestDefenseUseCase;
}
export function getSubmitProtestDefenseUseCase(): SubmitProtestDefenseUseCase {
return DIContainer.getInstance().submitProtestDefenseUseCase;
}
export function getTransferLeagueOwnershipUseCase(): TransferLeagueOwnershipUseCase {
return DIContainer.getInstance().transferLeagueOwnershipUseCase;
}
export function getSponsorRepository(): ISponsorRepository {
return DIContainer.getInstance().sponsorRepository;
}
export function getSeasonSponsorshipRepository(): ISeasonSponsorshipRepository {
return DIContainer.getInstance().seasonSponsorshipRepository;
}
export function getGetSponsorDashboardUseCase(): GetSponsorDashboardUseCase {
return DIContainer.getInstance().getSponsorDashboardUseCase;
}
export function getGetSponsorSponsorshipsUseCase(): GetSponsorSponsorshipsUseCase {
return DIContainer.getInstance().getSponsorSponsorshipsUseCase;
}
export function getSponsorshipRequestRepository(): ISponsorshipRequestRepository {
return DIContainer.getInstance().sponsorshipRequestRepository;
}
export function getSponsorshipPricingRepository(): ISponsorshipPricingRepository {
return DIContainer.getInstance().sponsorshipPricingRepository;
}
export function getApplyForSponsorshipUseCase(): ApplyForSponsorshipUseCase {
return DIContainer.getInstance().applyForSponsorshipUseCase;
}
export function getAcceptSponsorshipRequestUseCase(): AcceptSponsorshipRequestUseCase {
return DIContainer.getInstance().acceptSponsorshipRequestUseCase;
}
export function getRejectSponsorshipRequestUseCase(): RejectSponsorshipRequestUseCase {
return DIContainer.getInstance().rejectSponsorshipRequestUseCase;
}
export function getGetPendingSponsorshipRequestsUseCase(): GetPendingSponsorshipRequestsUseCase {
return DIContainer.getInstance().getPendingSponsorshipRequestsUseCase;
}
export function getGetEntitySponsorshipPricingUseCase(): GetEntitySponsorshipPricingUseCase {
return DIContainer.getInstance().getEntitySponsorshipPricingUseCase;
}
/**
* Reset function for testing
*/
export function resetContainer(): void {
DIContainer.reset();
}
/**
* Export stats from testing-support for backward compatibility
*/
export type { DriverStats };
/**
* Get driver statistics and rankings
* These functions access the demo driver stats registered in the DI container
*/
export function getDriverStats(driverId: string): DriverStats | null {
const container = DIContainer.getInstance();
// Ensure container is initialized
container['ensureInitialized']();
const stats = getDIContainer().resolve<Record<string, DriverStats>>(DI_TOKENS.DriverStats);
return stats[driverId] || null;
}
/**
* Get all driver rankings sorted by rating
*/
export function getAllDriverRankings(): DriverStats[] {
const container = DIContainer.getInstance();
// Ensure container is initialized
container['ensureInitialized']();
const stats = getDIContainer().resolve<Record<string, DriverStats>>(DI_TOKENS.DriverStats);
return Object.values(stats).sort((a, b) => b.rating - a.rating);
}
export { getDemoLeagueRankings as getLeagueRankings };

View File

@@ -1,177 +0,0 @@
/**
* Dependency Injection tokens for TSyringe container (Website)
*/
export const DI_TOKENS = {
// Repositories
DriverRepository: Symbol.for('IDriverRepository'),
LeagueRepository: Symbol.for('ILeagueRepository'),
RaceRepository: Symbol.for('IRaceRepository'),
ResultRepository: Symbol.for('IResultRepository'),
StandingRepository: Symbol.for('IStandingRepository'),
LeagueStandingsRepository: Symbol.for('ILeagueStandingsRepository'),
PenaltyRepository: Symbol.for('IPenaltyRepository'),
ProtestRepository: Symbol.for('IProtestRepository'),
TeamRepository: Symbol.for('ITeamRepository'),
TeamMembershipRepository: Symbol.for('ITeamMembershipRepository'),
RaceRegistrationRepository: Symbol.for('IRaceRegistrationRepository'),
LeagueMembershipRepository: Symbol.for('ILeagueMembershipRepository'),
GameRepository: Symbol.for('IGameRepository'),
SeasonRepository: Symbol.for('ISeasonRepository'),
LeagueScoringConfigRepository: Symbol.for('ILeagueScoringConfigRepository'),
TrackRepository: Symbol.for('ITrackRepository'),
CarRepository: Symbol.for('ICarRepository'),
FeedRepository: Symbol.for('IFeedRepository'),
SocialRepository: Symbol.for('ISocialGraphRepository'),
NotificationRepository: Symbol.for('INotificationRepository'),
NotificationPreferenceRepository: Symbol.for('INotificationPreferenceRepository'),
SponsorRepository: Symbol.for('ISponsorRepository'),
SeasonSponsorshipRepository: Symbol.for('ISeasonSponsorshipRepository'),
SponsorshipRequestRepository: Symbol.for('ISponsorshipRequestRepository'),
SponsorshipPricingRepository: Symbol.for('ISponsorshipPricingRepository'),
PageViewRepository: Symbol.for('IPageViewRepository'),
EngagementRepository: Symbol.for('IEngagementRepository'),
UserRepository: Symbol.for('IUserRepository'),
SponsorAccountRepository: Symbol.for('ISponsorAccountRepository'),
LiveryRepository: Symbol.for('ILiveryRepository'),
ChampionshipStandingRepository: Symbol.for('IChampionshipStandingRepository'),
LeagueWalletRepository: Symbol.for('ILeagueWalletRepository'),
TransactionRepository: Symbol.for('ITransactionRepository'),
SessionRepository: Symbol.for('ISessionRepository'),
AchievementRepository: Symbol.for('IAchievementRepository'),
UserRatingRepository: Symbol.for('IUserRatingRepository'),
// Providers
LeagueScoringPresetProvider: Symbol.for('LeagueScoringPresetProvider'),
DriverRatingProvider: Symbol.for('DriverRatingProvider'),
// Services
ImageService: Symbol.for('ImageServicePort'),
NotificationGatewayRegistry: Symbol.for('NotificationGatewayRegistry'),
Logger: Symbol.for('ILogger'),
AuthService: Symbol.for('AuthService'),
// Auth dependencies
IdentityProvider: Symbol.for('IdentityProvider'),
SessionPort: Symbol.for('SessionPort'),
// Use Cases - Auth
StartAuthUseCase: Symbol.for('StartAuthUseCase'),
GetCurrentUserSessionUseCase: Symbol.for('GetCurrentUserSessionUseCase'),
HandleAuthCallbackUseCase: Symbol.for('HandleAuthCallbackUseCase'),
LogoutUseCase: Symbol.for('LogoutUseCase'),
SignupWithEmailUseCase: Symbol.for('SignupWithEmailUseCase'),
LoginWithEmailUseCase: Symbol.for('LoginWithEmailUseCase'),
// Use Cases - Analytics
RecordPageViewUseCase: Symbol.for('RecordPageViewUseCase'),
RecordEngagementUseCase: Symbol.for('RecordEngagementUseCase'),
// Use Cases - Racing
JoinLeagueUseCase: Symbol.for('JoinLeagueUseCase'),
RegisterForRaceUseCase: Symbol.for('RegisterForRaceUseCase'),
WithdrawFromRaceUseCase: Symbol.for('WithdrawFromRaceUseCase'),
CreateLeagueWithSeasonAndScoringUseCase: Symbol.for('CreateLeagueWithSeasonAndScoringUseCase'),
TransferLeagueOwnershipUseCase: Symbol.for('TransferLeagueOwnershipUseCase'),
CancelRaceUseCase: Symbol.for('CancelRaceUseCase'),
CompleteRaceUseCase: Symbol.for('CompleteRaceUseCase'),
ImportRaceResultsUseCase: Symbol.for('ImportRaceResultsUseCase'),
// Queries - Dashboard
GetDashboardOverviewUseCase: Symbol.for('GetDashboardOverviewUseCase'),
GetProfileOverviewUseCase: Symbol.for('GetProfileOverviewUseCase'),
// Use Cases - Teams
CreateTeamUseCase: Symbol.for('CreateTeamUseCase'),
JoinTeamUseCase: Symbol.for('JoinTeamUseCase'),
LeaveTeamUseCase: Symbol.for('LeaveTeamUseCase'),
ApproveTeamJoinRequestUseCase: Symbol.for('ApproveTeamJoinRequestUseCase'),
RejectTeamJoinRequestUseCase: Symbol.for('RejectTeamJoinRequestUseCase'),
UpdateTeamUseCase: Symbol.for('UpdateTeamUseCase'),
// Use Cases - Stewarding
FileProtestUseCase: Symbol.for('FileProtestUseCase'),
ReviewProtestUseCase: Symbol.for('ReviewProtestUseCase'),
ApplyPenaltyUseCase: Symbol.for('ApplyPenaltyUseCase'),
QuickPenaltyUseCase: Symbol.for('QuickPenaltyUseCase'),
RequestProtestDefenseUseCase: Symbol.for('RequestProtestDefenseUseCase'),
SubmitProtestDefenseUseCase: Symbol.for('SubmitProtestDefenseUseCase'),
// Use Cases - Notifications
SendNotificationUseCase: Symbol.for('SendNotificationUseCase'),
MarkNotificationReadUseCase: Symbol.for('MarkNotificationReadUseCase'),
// Queries - Racing
IsDriverRegisteredForRaceUseCase: Symbol.for('IsDriverRegisteredForRaceUseCase'),
GetRaceRegistrationsUseCase: Symbol.for('GetRaceRegistrationsUseCase'),
GetLeagueStandingsUseCase: Symbol.for('GetLeagueStandingsUseCase'),
GetLeagueDriverSeasonStatsUseCase: Symbol.for('GetLeagueDriverSeasonStatsUseCase'),
GetAllLeaguesWithCapacityUseCase: Symbol.for('GetAllLeaguesWithCapacityUseCase'),
GetAllLeaguesWithCapacityAndScoringUseCase: Symbol.for('GetAllLeaguesWithCapacityAndScoringUseCase'),
ListLeagueScoringPresetsUseCase: Symbol.for('ListLeagueScoringPresetsUseCase'),
GetLeagueScoringConfigUseCase: Symbol.for('GetLeagueScoringConfigUseCase'),
GetLeagueFullConfigUseCase: Symbol.for('GetLeagueFullConfigUseCase'),
PreviewLeagueScheduleUseCase: Symbol.for('PreviewLeagueScheduleUseCase'),
GetRaceWithSOFUseCase: Symbol.for('GetRaceWithSOFUseCase'),
GetLeagueStatsUseCase: Symbol.for('GetLeagueStatsUseCase'),
ListSeasonsForLeagueUseCase: Symbol.for('ListSeasonsForLeagueUseCase'),
GetRacesPageDataUseCase: Symbol.for('GetRacesPageDataUseCase'),
GetAllRacesPageDataUseCase: Symbol.for('GetAllRacesPageDataUseCase'),
GetRaceDetailUseCase: Symbol.for('GetRaceDetailUseCase'),
GetRaceResultsDetailUseCase: Symbol.for('GetRaceResultsDetailUseCase'),
GetDriversLeaderboardUseCase: Symbol.for('GetDriversLeaderboardUseCase'),
GetTeamsLeaderboardUseCase: Symbol.for('GetTeamsLeaderboardUseCase'),
// Use Cases - Teams (Query-like)
GetAllTeamsUseCase: Symbol.for('GetAllTeamsUseCase'),
GetTeamDetailsUseCase: Symbol.for('GetTeamDetailsUseCase'),
GetTeamMembersUseCase: Symbol.for('GetTeamMembersUseCase'),
GetTeamJoinRequestsUseCase: Symbol.for('GetTeamJoinRequestsUseCase'),
GetDriverTeamUseCase: Symbol.for('GetDriverTeamUseCase'),
// Queries - Stewarding
GetRaceProtestsUseCase: Symbol.for('GetRaceProtestsUseCase'),
GetRacePenaltiesUseCase: Symbol.for('GetRacePenaltiesUseCase'),
// Queries - Notifications
GetUnreadNotificationsUseCase: Symbol.for('GetUnreadNotificationsUseCase'),
// Use Cases - Sponsors
GetSponsorDashboardUseCase: Symbol.for('GetSponsorDashboardUseCase'),
GetSponsorSponsorshipsUseCase: Symbol.for('GetSponsorSponsorshipsUseCase'),
GetPendingSponsorshipRequestsUseCase: Symbol.for('GetPendingSponsorshipRequestsUseCase'),
GetEntitySponsorshipPricingUseCase: Symbol.for('GetEntitySponsorshipPricingUseCase'),
// Use Cases - Sponsorship
ApplyForSponsorshipUseCase: Symbol.for('ApplyForSponsorshipUseCase'),
AcceptSponsorshipRequestUseCase: Symbol.for('AcceptSponsorshipRequestUseCase'),
RejectSponsorshipRequestUseCase: Symbol.for('RejectSponsorshipRequestUseCase'),
// Use Cases - Driver Profile
UpdateDriverProfileUseCase: Symbol.for('UpdateDriverProfileUseCase'),
// Data
DriverStats: Symbol.for('DriverStats'),
// Presenters - Racing
LeagueStandingsPresenter: Symbol.for('ILeagueStandingsPresenter'),
RaceWithSOFPresenter: Symbol.for('IRaceWithSOFPresenter'),
RaceProtestsPresenter: Symbol.for('IRaceProtestsPresenter'),
RacePenaltiesPresenter: Symbol.for('IRacePenaltiesPresenter'),
RaceRegistrationsPresenter: Symbol.for('IRaceRegistrationsPresenter'),
DriverRegistrationStatusPresenter: Symbol.for('IDriverRegistrationStatusPresenter'),
RaceDetailPresenter: Symbol.for('IRaceDetailPresenter'),
RaceResultsDetailPresenter: Symbol.for('IRaceResultsDetailPresenter'),
ImportRaceResultsPresenter: Symbol.for('IImportRaceResultsPresenter'),
DashboardOverviewPresenter: Symbol.for('IDashboardOverviewPresenter'),
ProfileOverviewPresenter: Symbol.for('IProfileOverviewPresenter'),
// Presenters - Sponsors
SponsorDashboardPresenter: Symbol.for('ISponsorDashboardPresenter'),
SponsorSponsorshipsPresenter: Symbol.for('ISponsorSponsorshipsPresenter'),
PendingSponsorshipRequestsPresenter: Symbol.for('IPendingSponsorshipRequestsPresenter'),
EntitySponsorshipPricingPresenter: Symbol.for('IEntitySponsorshipPricingPresenter'),
LeagueSchedulePreviewPresenter: Symbol.for('ILeagueSchedulePreviewPresenter'),
} as const;
export type DITokens = typeof DI_TOKENS;

View File

@@ -30,7 +30,8 @@
"@gridpilot/media/*": ["../../core/media/*"],
"@gridpilot/shared/logging": ["../../core/shared/logging"],
"@gridpilot/shared/*": ["../../core/shared/*"],
"@gridpilot/core/*": ["../../core/*"]
"@gridpilot/core/*": ["../../core/*"],
"@gridpilot/api/*": ["../../apps/api/src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],