website refactor
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
import { Result } from '@/lib/contracts/Result';
|
||||
import { DomainError } from '@/lib/contracts/services/Service';
|
||||
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
|
||||
@@ -7,14 +15,34 @@ import { DomainError } from '@/lib/contracts/services/Service';
|
||||
* Returns raw API DTOs. No ViewModels or UX logic.
|
||||
* All client-side presentation logic must be handled by hooks/components.
|
||||
*/
|
||||
export class LandingService {
|
||||
constructor(private readonly apiClient: any) {}
|
||||
export class LandingService implements Service {
|
||||
private racesApi: RacesApiClient;
|
||||
private leaguesApi: LeaguesApiClient;
|
||||
private teamsApi: TeamsApiClient;
|
||||
private authApi: AuthApiClient;
|
||||
|
||||
async getLandingData(): Promise<any> {
|
||||
return { featuredLeagues: [], stats: {} };
|
||||
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 signup(email: string): Promise<Result<void, DomainError>> {
|
||||
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' });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user