code quality
Some checks failed
CI / lint-typecheck (pull_request) Failing after 12s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
Some checks failed
CI / lint-typecheck (pull_request) Failing after 12s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
This commit is contained in:
@@ -4,7 +4,8 @@ import { Result } from '@/lib/contracts/Result';
|
||||
import { DomainError, Service } from '@/lib/contracts/services/Service';
|
||||
import { EnhancedErrorReporter } from '@/lib/infrastructure/EnhancedErrorReporter';
|
||||
import { ConsoleLogger } from '@/lib/infrastructure/logging/ConsoleLogger';
|
||||
import type { DashboardStats, UserDto, UserListResponse } from '@/lib/types/admin';
|
||||
import type { DashboardStatsResponseDTO } from '@/lib/types/generated/DashboardStatsResponseDTO';
|
||||
import type { UserDto, UserListResponse } from '@/lib/types/admin';
|
||||
import { injectable } from 'inversify';
|
||||
|
||||
/**
|
||||
@@ -31,9 +32,9 @@ export class AdminService implements Service {
|
||||
/**
|
||||
* Get dashboard statistics
|
||||
*/
|
||||
async getDashboardStats(): Promise<Result<DashboardStats, DomainError>> {
|
||||
async getDashboardStats(): Promise<Result<DashboardStatsResponseDTO, DomainError>> {
|
||||
// Mock data until API is implemented
|
||||
const mockStats: DashboardStats = {
|
||||
const mockStats: DashboardStatsResponseDTO = {
|
||||
totalUsers: 1250,
|
||||
activeUsers: 1100,
|
||||
suspendedUsers: 50,
|
||||
@@ -41,23 +42,23 @@ export class AdminService implements Service {
|
||||
systemAdmins: 5,
|
||||
recentLogins: 450,
|
||||
newUsersToday: 12,
|
||||
userGrowth: [
|
||||
{ label: 'This week', value: 45, color: '#10b981' },
|
||||
{ label: 'Last week', value: 38, color: '#3b82f6' },
|
||||
],
|
||||
roleDistribution: [
|
||||
{ label: 'Users', value: 1200, color: '#6b7280' },
|
||||
{ label: 'Admins', value: 50, color: '#8b5cf6' },
|
||||
],
|
||||
userGrowth: {},
|
||||
roleDistribution: {},
|
||||
statusDistribution: {
|
||||
active: 1100,
|
||||
suspended: 50,
|
||||
deleted: 100,
|
||||
},
|
||||
activityTimeline: [
|
||||
{ date: '2024-01-01', newUsers: 10, logins: 200 },
|
||||
{ date: '2024-01-02', newUsers: 15, logins: 220 },
|
||||
],
|
||||
activityTimeline: {},
|
||||
label: 'Growth',
|
||||
value: 45,
|
||||
color: '#10b981',
|
||||
active: 1100,
|
||||
suspended: 50,
|
||||
deleted: 100,
|
||||
date: '2024-01-01',
|
||||
newUsers: 10,
|
||||
logins: 200,
|
||||
};
|
||||
return Result.ok(mockStats);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Result } from '@/lib/contracts/Result';
|
||||
import { DomainError, Service } from '@/lib/contracts/services/Service';
|
||||
import { DriversApiClient } from '@/lib/gateways/api/drivers/DriversApiClient';
|
||||
import { ConsoleLogger } from '@/lib/infrastructure/logging/ConsoleLogger';
|
||||
import { EnhancedErrorReporter } from '@/lib/infrastructure/EnhancedErrorReporter';
|
||||
import type {
|
||||
CompleteOnboardingInputDTO,
|
||||
DriverDTO,
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { Result } from '@/lib/contracts/Result';
|
||||
import { DomainError, Service } from '@/lib/contracts/services/Service';
|
||||
import { WalletsApiClient } from '@/lib/gateways/api/wallets/WalletsApiClient';
|
||||
import { LeagueWalletApiDto } from '@/lib/types/tbd/LeagueWalletApiDto';
|
||||
import type { GetLeagueWalletOutputDTO, WalletTransactionDTO } from '@/lib/types/generated';
|
||||
import { injectable, unmanaged } from 'inversify';
|
||||
|
||||
@injectable()
|
||||
export class LeagueWalletService implements Service {
|
||||
constructor(@unmanaged() private readonly apiClient?: WalletsApiClient) {}
|
||||
|
||||
async getWalletForLeague(leagueId: string): Promise<LeagueWalletApiDto> {
|
||||
async getWalletForLeague(leagueId: string): Promise<GetLeagueWalletOutputDTO> {
|
||||
if (this.apiClient) {
|
||||
const res = await this.apiClient.getLeagueWallet(leagueId);
|
||||
return ((res as any).value || res) as any;
|
||||
@@ -38,10 +38,9 @@ export class LeagueWalletService implements Service {
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
async getWalletData(leagueId: string): Promise<Result<LeagueWalletApiDto, DomainError>> {
|
||||
async getWalletData(leagueId: string): Promise<Result<GetLeagueWalletOutputDTO, DomainError>> {
|
||||
// Mock data since backend not implemented
|
||||
const mockData: LeagueWalletApiDto = {
|
||||
leagueId,
|
||||
const mockData: GetLeagueWalletOutputDTO = {
|
||||
balance: 15750.00,
|
||||
currency: 'USD',
|
||||
totalRevenue: 7500.00,
|
||||
@@ -55,7 +54,9 @@ export class LeagueWalletService implements Service {
|
||||
type: 'sponsorship',
|
||||
amount: 5000.00,
|
||||
description: 'Main sponsorship from Acme Racing',
|
||||
createdAt: '2024-10-01T10:00:00Z',
|
||||
fee: 0,
|
||||
netAmount: 5000.00,
|
||||
date: '2024-10-01T10:00:00Z',
|
||||
status: 'completed',
|
||||
},
|
||||
{
|
||||
@@ -63,7 +64,9 @@ export class LeagueWalletService implements Service {
|
||||
type: 'prize',
|
||||
amount: 2500.00,
|
||||
description: 'Prize money from championship',
|
||||
createdAt: '2024-09-15T14:30:00Z',
|
||||
fee: 0,
|
||||
netAmount: 2500.00,
|
||||
date: '2024-09-15T14:30:00Z',
|
||||
status: 'completed',
|
||||
},
|
||||
{
|
||||
@@ -71,7 +74,9 @@ export class LeagueWalletService implements Service {
|
||||
type: 'withdrawal',
|
||||
amount: -1200.00,
|
||||
description: 'Equipment purchase',
|
||||
createdAt: '2024-09-10T09:15:00Z',
|
||||
fee: 0,
|
||||
netAmount: -1200.00,
|
||||
date: '2024-09-10T09:15:00Z',
|
||||
status: 'completed',
|
||||
},
|
||||
{
|
||||
@@ -79,7 +84,9 @@ export class LeagueWalletService implements Service {
|
||||
type: 'deposit',
|
||||
amount: 5000.00,
|
||||
description: 'Entry fees from season registration',
|
||||
createdAt: '2024-08-01T12:00:00Z',
|
||||
fee: 0,
|
||||
netAmount: 5000.00,
|
||||
date: '2024-08-01T12:00:00Z',
|
||||
status: 'completed',
|
||||
},
|
||||
],
|
||||
|
||||
@@ -5,6 +5,9 @@ import { ApiError } from '@/lib/gateways/api/base/ApiError';
|
||||
import { PenaltiesApiClient } from '@/lib/gateways/api/penalties/PenaltiesApiClient';
|
||||
import { ProtestsApiClient } from '@/lib/gateways/api/protests/ProtestsApiClient';
|
||||
import { RacesApiClient } from '@/lib/gateways/api/races/RacesApiClient';
|
||||
import type { LeagueAdminProtestsDTO } from '@/lib/types/generated/LeagueAdminProtestsDTO';
|
||||
import type { RaceDTO } from '@/lib/types/generated/RaceDTO';
|
||||
import type { DriverDTO } from '@/lib/types/generated/DriverDTO';
|
||||
import { ConsoleErrorReporter } from '@/lib/infrastructure/logging/ConsoleErrorReporter';
|
||||
import { ConsoleLogger } from '@/lib/infrastructure/logging/ConsoleLogger';
|
||||
import { RaceStewardingViewModel } from '@/lib/view-models/RaceStewardingViewModel';
|
||||
@@ -54,7 +57,7 @@ export class RaceStewardingService implements Service {
|
||||
* Get race stewarding data
|
||||
* Returns protests and penalties for a race
|
||||
*/
|
||||
async getRaceStewarding(raceId: string, driverId: string = ''): Promise<Result<unknown, DomainError>> {
|
||||
async getRaceStewarding(raceId: string, driverId: string = ''): Promise<Result<LeagueAdminProtestsDTO, DomainError>> {
|
||||
try {
|
||||
// Fetch data in parallel
|
||||
const [raceDetail, protests, penalties] = await Promise.all([
|
||||
@@ -67,8 +70,12 @@ export class RaceStewardingService implements Service {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const protestsData = protests.protests.map((p: any) => ({
|
||||
id: p.id,
|
||||
leagueId: p.leagueId,
|
||||
raceId: p.raceId,
|
||||
protestingDriverId: p.protestingDriverId,
|
||||
accusedDriverId: p.accusedDriverId,
|
||||
description: p.description,
|
||||
submittedAt: p.submittedAt,
|
||||
incident: {
|
||||
lap: p.lap,
|
||||
description: p.description,
|
||||
@@ -97,6 +104,8 @@ export class RaceStewardingService implements Service {
|
||||
pendingCount: pendingProtests.length,
|
||||
resolvedCount: resolvedProtests.length,
|
||||
penaltiesCount: penalties.penalties.length,
|
||||
racesById: raceDetail.race ? { [raceId]: raceDetail.race as unknown as RaceDTO } : {},
|
||||
driversById: { ...protests.driverMap, ...penalties.driverMap } as unknown as Record<string, DriverDTO>,
|
||||
};
|
||||
|
||||
return Result.ok(data);
|
||||
|
||||
Reference in New Issue
Block a user