website refactor

This commit is contained in:
2026-01-16 01:00:03 +01:00
parent ce7be39155
commit a98e3e3166
286 changed files with 5522 additions and 5261 deletions

View File

@@ -2,7 +2,7 @@ import { SponsorsApiClient } from '@/lib/api/sponsors/SponsorsApiClient';
import { getWebsiteApiBaseUrl } from '@/lib/config/apiBaseUrl';
import { isProductionEnvironment } from '@/lib/config/env';
import { Result } from '@/lib/contracts/Result';
import type { Service } from '@/lib/contracts/services/Service';
import { Service, DomainError } from '@/lib/contracts/services/Service';
import { EnhancedErrorReporter } from '@/lib/infrastructure/EnhancedErrorReporter';
import { ConsoleLogger } from '@/lib/infrastructure/logging/ConsoleLogger';
import type { GetPendingSponsorshipRequestsOutputDTO } from '@/lib/types/generated/GetPendingSponsorshipRequestsOutputDTO';
@@ -31,7 +31,7 @@ export class SponsorshipRequestsService implements Service {
async getPendingRequests(
input: GetPendingRequestsInput,
): Promise<Result<GetPendingSponsorshipRequestsOutputDTO, 'GET_PENDING_REQUESTS_FAILED'>> {
): Promise<Result<GetPendingSponsorshipRequestsOutputDTO, DomainError>> {
try {
const result = await this.client.getPendingSponsorshipRequests({
entityType: input.entityType,
@@ -40,13 +40,13 @@ export class SponsorshipRequestsService implements Service {
return Result.ok(result);
} catch {
return Result.err('GET_PENDING_REQUESTS_FAILED');
return Result.err({ type: 'serverError', message: 'Failed to fetch pending requests' });
}
}
async acceptRequest(
command: { requestId: string; actorDriverId: string },
): Promise<Result<void, 'ACCEPT_SPONSORSHIP_REQUEST_FAILED'>> {
): Promise<Result<void, DomainError>> {
try {
const input: AcceptSponsorshipRequestInputDTO = {
respondedBy: command.actorDriverId,
@@ -55,13 +55,13 @@ export class SponsorshipRequestsService implements Service {
return Result.ok(undefined);
} catch {
return Result.err('ACCEPT_SPONSORSHIP_REQUEST_FAILED');
return Result.err({ type: 'serverError', message: 'Failed to accept sponsorship request' });
}
}
async rejectRequest(
command: { requestId: string; actorDriverId: string; reason: string | null },
): Promise<Result<void, 'REJECT_SPONSORSHIP_REQUEST_FAILED'>> {
): Promise<Result<void, DomainError>> {
try {
const input: RejectSponsorshipRequestInputDTO = {
respondedBy: command.actorDriverId,
@@ -71,7 +71,7 @@ export class SponsorshipRequestsService implements Service {
return Result.ok(undefined);
} catch {
return Result.err('REJECT_SPONSORSHIP_REQUEST_FAILED');
return Result.err({ type: 'serverError', message: 'Failed to reject sponsorship request' });
}
}
}