49 lines
2.0 KiB
TypeScript
49 lines
2.0 KiB
TypeScript
import { Result } from '@/lib/contracts/Result';
|
|
import { DomainError, Service } from '@/lib/contracts/services/Service';
|
|
import { RacesApiClient } from '@/lib/api/races/RacesApiClient';
|
|
import { LeaguesApiClient } from '@/lib/api/leagues/LeaguesApiClient';
|
|
import { TeamsApiClient } from '@/lib/api/teams/TeamsApiClient';
|
|
import { AuthApiClient } from '@/lib/api/auth/AuthApiClient';
|
|
import { ConsoleLogger } from '@/lib/infrastructure/logging/ConsoleLogger';
|
|
import { EnhancedErrorReporter } from '@/lib/infrastructure/EnhancedErrorReporter';
|
|
import { getWebsiteApiBaseUrl } from '@/lib/config/apiBaseUrl';
|
|
import { isProductionEnvironment } from '@/lib/config/env';
|
|
|
|
/**
|
|
* Landing Service - DTO Only
|
|
*
|
|
* Returns raw API DTOs. No ViewModels or UX logic.
|
|
* All client-side presentation logic must be handled by hooks/components.
|
|
*/
|
|
export class LandingService implements Service {
|
|
private racesApi: RacesApiClient;
|
|
private leaguesApi: LeaguesApiClient;
|
|
private teamsApi: TeamsApiClient;
|
|
private authApi: AuthApiClient;
|
|
|
|
constructor() {
|
|
const baseUrl = getWebsiteApiBaseUrl();
|
|
const logger = new ConsoleLogger();
|
|
const errorReporter = new EnhancedErrorReporter(logger, {
|
|
showUserNotifications: true,
|
|
logToConsole: true,
|
|
reportToExternal: isProductionEnvironment(),
|
|
});
|
|
|
|
this.racesApi = new RacesApiClient(baseUrl, errorReporter, logger);
|
|
this.leaguesApi = new LeaguesApiClient(baseUrl, errorReporter, logger);
|
|
this.teamsApi = new TeamsApiClient(baseUrl, errorReporter, logger);
|
|
this.authApi = new AuthApiClient(baseUrl, errorReporter, logger);
|
|
}
|
|
|
|
async getLandingData(): Promise<Result<{ featuredLeagues: unknown[]; stats: Record<string, unknown> }, DomainError>> {
|
|
return Result.ok({ featuredLeagues: [], stats: {} });
|
|
}
|
|
|
|
async signup(_email: string): Promise<Result<void, DomainError>> {
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
const email = _email;
|
|
return Result.err({ type: 'notImplemented', message: 'Email signup endpoint' });
|
|
}
|
|
}
|