services refactor

This commit is contained in:
2025-12-17 22:17:02 +01:00
parent 26f7a2b6aa
commit 055a7f67b5
93 changed files with 7434 additions and 659 deletions

View File

@@ -4,6 +4,8 @@ import type {
RecordPageViewOutputDto,
RecordEngagementInputDto,
RecordEngagementOutputDto,
AnalyticsDashboardDto,
AnalyticsMetricsDto,
} from '../../dtos';
/**
@@ -21,4 +23,14 @@ export class AnalyticsApiClient extends BaseApiClient {
recordEngagement(input: RecordEngagementInputDto): Promise<RecordEngagementOutputDto> {
return this.post<RecordEngagementOutputDto>('/analytics/engagement', input);
}
/** Get analytics dashboard data */
getDashboardData(): Promise<AnalyticsDashboardDto> {
return this.get<AnalyticsDashboardDto>('/analytics/dashboard');
}
/** Get analytics metrics */
getAnalyticsMetrics(): Promise<AnalyticsMetricsDto> {
return this.get<AnalyticsMetricsDto>('/analytics/metrics');
}
}

View File

@@ -4,6 +4,7 @@ import type {
CompleteOnboardingInputDto,
CompleteOnboardingOutputDto,
DriverDto,
DriverRegistrationStatusDto,
} from '../../dtos';
/**
@@ -26,4 +27,9 @@ export class DriversApiClient extends BaseApiClient {
getCurrent(): Promise<DriverDto | null> {
return this.get<DriverDto | null>('/drivers/current');
}
/** Get driver registration status for a specific race */
getRegistrationStatus(driverId: string, raceId: string): Promise<DriverRegistrationStatusDto> {
return this.get<DriverRegistrationStatusDto>(`/drivers/${driverId}/races/${raceId}/registration-status`);
}
}

View File

@@ -2,6 +2,13 @@ import { BaseApiClient } from '../base/BaseApiClient';
import type {
RequestAvatarGenerationInputDto,
RequestAvatarGenerationOutputDto,
UploadMediaInputDto,
UploadMediaOutputDto,
GetMediaOutputDto,
DeleteMediaOutputDto,
GetAvatarOutputDto,
UpdateAvatarInputDto,
UpdateAvatarOutputDto,
} from '../../dtos';
/**
@@ -10,8 +17,39 @@ import type {
* Handles all media-related API operations.
*/
export class MediaApiClient extends BaseApiClient {
/** Upload media file */
uploadMedia(input: UploadMediaInputDto): Promise<UploadMediaOutputDto> {
const formData = new FormData();
formData.append('file', input.file);
formData.append('type', input.type);
if (input.category) {
formData.append('category', input.category);
}
return this.post<UploadMediaOutputDto>('/media/upload', formData);
}
/** Get media by ID */
getMedia(mediaId: string): Promise<GetMediaOutputDto> {
return this.get<GetMediaOutputDto>(`/media/${mediaId}`);
}
/** Delete media by ID */
deleteMedia(mediaId: string): Promise<DeleteMediaOutputDto> {
return this.delete<DeleteMediaOutputDto>(`/media/${mediaId}`);
}
/** Request avatar generation */
requestAvatarGeneration(input: RequestAvatarGenerationInputDto): Promise<RequestAvatarGenerationOutputDto> {
return this.post<RequestAvatarGenerationOutputDto>('/media/avatar/generate', input);
}
/** Get avatar for driver */
getAvatar(driverId: string): Promise<GetAvatarOutputDto> {
return this.get<GetAvatarOutputDto>(`/media/avatar/${driverId}`);
}
/** Update avatar for driver */
updateAvatar(input: UpdateAvatarInputDto): Promise<UpdateAvatarOutputDto> {
return this.put<UpdateAvatarOutputDto>(`/media/avatar/${input.driverId}`, { avatarUrl: input.avatarUrl });
}
}

View File

@@ -6,6 +6,11 @@ import type {
GetMembershipFeesOutputDto,
GetPrizesOutputDto,
GetWalletOutputDto,
ProcessWalletTransactionInputDto,
ProcessWalletTransactionOutputDto,
UpdateMemberPaymentInputDto,
UpdateMemberPaymentOutputDto,
GetWalletTransactionsOutputDto,
} from '../../dtos';
/**