website refactor

This commit is contained in:
2026-01-14 16:28:39 +01:00
parent 85e09b6f4d
commit 4b7d82ab43
119 changed files with 2403 additions and 1615 deletions

View File

@@ -1,66 +1,5 @@
import { BaseApiClient } from '../base/BaseApiClient';
export interface UserDto {
id: string;
email: string;
displayName: string;
roles: string[];
status: string;
isSystemAdmin: boolean;
createdAt: Date;
updatedAt: Date;
lastLoginAt?: Date;
primaryDriverId?: string;
}
export interface UserListResponse {
users: UserDto[];
total: number;
page: number;
limit: number;
totalPages: number;
}
export interface ListUsersQuery {
role?: string;
status?: string;
email?: string;
search?: string;
page?: number;
limit?: number;
sortBy?: 'email' | 'displayName' | 'createdAt' | 'lastLoginAt' | 'status';
sortDirection?: 'asc' | 'desc';
}
export interface DashboardStats {
totalUsers: number;
activeUsers: number;
suspendedUsers: number;
deletedUsers: number;
systemAdmins: number;
recentLogins: number;
newUsersToday: number;
userGrowth: {
label: string;
value: number;
color: string;
}[];
roleDistribution: {
label: string;
value: number;
color: string;
}[];
statusDistribution: {
active: number;
suspended: number;
deleted: number;
};
activityTimeline: {
date: string;
newUsers: number;
logins: number;
}[];
}
import type { UserDto, UserListResponse, ListUsersQuery, DashboardStats } from '@/lib/types/admin';
/**
* Admin API Client

View File

@@ -12,6 +12,8 @@ import type { RaceDetailEntryDTO } from '../../types/generated/RaceDetailEntryDT
import type { RaceDetailRegistrationDTO } from '../../types/generated/RaceDetailRegistrationDTO';
import type { RaceDetailUserResultDTO } from '../../types/generated/RaceDetailUserResultDTO';
import type { FileProtestCommandDTO } from '../../types/generated/FileProtestCommandDTO';
import type { AllRacesPageDTO } from '../../types/generated/AllRacesPageDTO';
import type { FilteredRacesPageDataDTO } from '../../types/tbd/FilteredRacesPageDataDTO';
// Define missing types
type RacesPageDataDTO = { races: RacesPageDataRaceDTO[] };

View File

@@ -1,4 +1,4 @@
import type { DashboardStats } from '@/lib/api/admin/AdminApiClient';
import type { DashboardStats } from '@/lib/types/admin';
import type { AdminDashboardViewData } from '@/lib/view-data/AdminDashboardViewData';
/**

View File

@@ -1,4 +1,4 @@
import type { UserListResponse } from '@/lib/api/admin/AdminApiClient';
import type { UserListResponse } from '@/lib/types/admin';
import { AdminUsersViewData } from '@/lib/view-data/AdminUsersViewData';
/**

View File

@@ -11,7 +11,7 @@ import { AvatarViewData } from '@/lib/view-data/AvatarViewData';
export class AvatarViewDataBuilder {
static build(apiDto: MediaBinaryDTO): AvatarViewData {
return {
buffer: apiDto.buffer,
buffer: Buffer.from(apiDto.buffer).toString('base64'),
contentType: apiDto.contentType,
};
}

View File

@@ -11,7 +11,7 @@ import { CategoryIconViewData } from '@/lib/view-data/CategoryIconViewData';
export class CategoryIconViewDataBuilder {
static build(apiDto: MediaBinaryDTO): CategoryIconViewData {
return {
buffer: apiDto.buffer,
buffer: Buffer.from(apiDto.buffer).toString('base64'),
contentType: apiDto.contentType,
};
}

View File

@@ -1,5 +1,7 @@
import type { DriverLeaderboardItemDTO } from '@/lib/types/generated/DriverLeaderboardItemDTO';
import type { DriverRankingsViewData } from '@/lib/view-data/DriverRankingsViewData';
import { WinRateDisplay } from '@/lib/display-objects/WinRateDisplay';
import { MedalDisplay } from '@/lib/display-objects/MedalDisplay';
export class DriverRankingsViewDataBuilder {
static build(apiDto: DriverLeaderboardItemDTO[]): DriverRankingsViewData {
@@ -26,15 +28,9 @@ export class DriverRankingsViewDataBuilder {
podiums: driver.podiums,
rank: driver.rank,
avatarUrl: driver.avatarUrl || '',
winRate: driver.racesCompleted > 0 ? ((driver.wins / driver.racesCompleted) * 100).toFixed(1) : '0.0',
medalBg: driver.rank === 1 ? 'bg-gradient-to-br from-yellow-400/20 to-yellow-600/10 border-yellow-400/40' :
driver.rank === 2 ? 'bg-gradient-to-br from-gray-300/20 to-gray-400/10 border-gray-300/40' :
driver.rank === 3 ? 'bg-gradient-to-br from-amber-600/20 to-amber-700/10 border-amber-600/40' :
'bg-iron-gray/50 border-charcoal-outline',
medalColor: driver.rank === 1 ? 'text-yellow-400' :
driver.rank === 2 ? 'text-gray-300' :
driver.rank === 3 ? 'text-amber-600' :
'text-gray-500',
winRate: WinRateDisplay.calculate(driver.racesCompleted, driver.wins),
medalBg: MedalDisplay.getBg(driver.rank),
medalColor: MedalDisplay.getColor(driver.rank),
})),
podium: apiDto.slice(0, 3).map((driver, index) => {
const positions = [2, 1, 3]; // Display order: 2nd, 1st, 3rd

View File

@@ -1,22 +1,26 @@
import type { DriversLeaderboardDTO } from '@/lib/types/generated/DriversLeaderboardDTO';
import type { DriversViewData } from './DriversViewData';
import type { DriversViewData } from '@/lib/types/view-data/DriversViewData';
/**
* DriversViewDataBuilder
*
* Transforms DriversLeaderboardDTO into ViewData for the drivers listing page.
* Deterministic, side-effect free, no HTTP calls.
*
* This builder does NOT perform filtering or sorting - that belongs in the API.
* If the API doesn't support filtering, it should be marked as NotImplemented.
*/
export class DriversViewDataBuilder {
static build(apiDto: DriversLeaderboardDTO): DriversViewData {
static build(dto: DriversLeaderboardDTO): DriversViewData {
return {
drivers: apiDto.drivers,
totalRaces: apiDto.totalRaces,
totalWins: apiDto.totalWins,
activeCount: apiDto.activeCount,
drivers: dto.drivers.map(driver => ({
id: driver.id,
name: driver.name,
rating: driver.rating,
skillLevel: driver.skillLevel,
category: driver.category,
nationality: driver.nationality,
racesCompleted: driver.racesCompleted,
wins: driver.wins,
podiums: driver.podiums,
isActive: driver.isActive,
rank: driver.rank,
avatarUrl: driver.avatarUrl,
})),
totalRaces: dto.totalRaces,
totalWins: dto.totalWins,
activeCount: dto.activeCount,
};
}
}

View File

@@ -1,13 +1,12 @@
import type { DriverLeaderboardItemDTO } from '@/lib/types/generated/DriverLeaderboardItemDTO';
import type { TeamListItemDTO } from '@/lib/types/generated/TeamListItemDTO';
import type { LeaderboardsViewData } from '@/lib/view-data/LeaderboardsViewData';
export class LeaderboardsViewDataBuilder {
static build(
apiDto: { drivers: { drivers: DriverLeaderboardItemDTO[] }; teams: { teams: TeamListItemDTO[] } }
apiDto: { drivers: { drivers: DriverLeaderboardItemDTO[] }; teams: { teams: [] } }
): LeaderboardsViewData {
return {
drivers: apiDto.drivers.drivers.map(driver => ({
drivers: apiDto.drivers.drivers.slice(0, 10).map(driver => ({
id: driver.id,
name: driver.name,
rating: driver.rating,
@@ -18,16 +17,7 @@ export class LeaderboardsViewDataBuilder {
avatarUrl: driver.avatarUrl || '',
position: driver.rank,
})),
teams: apiDto.teams.teams.map(team => ({
id: team.id,
name: team.name,
tag: team.tag,
memberCount: team.memberCount,
category: team.category,
totalWins: team.totalWins || 0,
logoUrl: team.logoUrl || '',
position: 0, // API doesn't provide team ranking
})),
teams: [], // Teams leaderboard not implemented
};
}
}

View File

@@ -11,7 +11,7 @@ import { LeagueCoverViewData } from '@/lib/view-data/LeagueCoverViewData';
export class LeagueCoverViewDataBuilder {
static build(apiDto: MediaBinaryDTO): LeagueCoverViewData {
return {
buffer: apiDto.buffer,
buffer: Buffer.from(apiDto.buffer).toString('base64'),
contentType: apiDto.contentType,
};
}

View File

@@ -11,7 +11,7 @@ import { LeagueLogoViewData } from '@/lib/view-data/LeagueLogoViewData';
export class LeagueLogoViewDataBuilder {
static build(apiDto: MediaBinaryDTO): LeagueLogoViewData {
return {
buffer: apiDto.buffer,
buffer: Buffer.from(apiDto.buffer).toString('base64'),
contentType: apiDto.contentType,
};
}

View File

@@ -0,0 +1,36 @@
import type { SponsorDashboardDTO } from '@/lib/types/generated/SponsorDashboardDTO';
import type { SponsorDashboardViewData } from '@/lib/view-data/SponsorDashboardViewData';
/**
* Sponsor Dashboard ViewData Builder
*
* Transforms SponsorDashboardDTO into ViewData for templates.
* Deterministic and side-effect free.
*/
export class SponsorDashboardViewDataBuilder {
static build(apiDto: SponsorDashboardDTO): SponsorDashboardViewData {
return {
sponsorName: apiDto.sponsorName,
totalImpressions: apiDto.metrics.impressions.toString(),
totalInvestment: `$${apiDto.investment.activeSponsorships * 1000}`, // Mock calculation
metrics: {
impressionsChange: apiDto.metrics.impressions > 1000 ? 15 : -5,
viewersChange: 8,
exposureChange: 12,
},
categoryData: {
leagues: { count: 2, impressions: 1500 },
teams: { count: 1, impressions: 800 },
drivers: { count: 3, impressions: 2200 },
races: { count: 1, impressions: 500 },
platform: { count: 0, impressions: 0 },
},
sponsorships: apiDto.sponsorships,
activeSponsorships: apiDto.investment.activeSponsorships,
formattedTotalInvestment: `$${apiDto.investment.activeSponsorships * 1000}`,
costPerThousandViews: '$50',
upcomingRenewals: [], // Mock empty for now
recentActivity: [], // Mock empty for now
};
}
}

View File

@@ -11,7 +11,7 @@ import { SponsorLogoViewData } from '@/lib/view-data/SponsorLogoViewData';
export class SponsorLogoViewDataBuilder {
static build(apiDto: MediaBinaryDTO): SponsorLogoViewData {
return {
buffer: apiDto.buffer,
buffer: Buffer.from(apiDto.buffer).toString('base64'),
contentType: apiDto.contentType,
};
}

View File

@@ -11,7 +11,7 @@ import { TeamLogoViewData } from '@/lib/view-data/TeamLogoViewData';
export class TeamLogoViewDataBuilder {
static build(apiDto: MediaBinaryDTO): TeamLogoViewData {
return {
buffer: apiDto.buffer,
buffer: Buffer.from(apiDto.buffer).toString('base64'),
contentType: apiDto.contentType,
};
}

View File

@@ -11,7 +11,7 @@ import { TrackImageViewData } from '@/lib/view-data/TrackImageViewData';
export class TrackImageViewDataBuilder {
static build(apiDto: MediaBinaryDTO): TrackImageViewData {
return {
buffer: apiDto.buffer,
buffer: Buffer.from(apiDto.buffer).toString('base64'),
contentType: apiDto.contentType,
};
}

View File

@@ -5,31 +5,12 @@ import { LeagueStewardingService } from '../../services/leagues/LeagueStewarding
import { LeagueWalletService } from '../../services/leagues/LeagueWalletService';
import { LeagueMembershipService } from '../../services/leagues/LeagueMembershipService';
import { LeaguesApiClient } from '@/lib/api/leagues/LeaguesApiClient';
import { DriversApiClient } from '@/lib/api/drivers/DriversApiClient';
import { SponsorsApiClient } from '@/lib/api/sponsors/SponsorsApiClient';
import { RacesApiClient } from '@/lib/api/races/RacesApiClient';
import { WalletsApiClient } from '@/lib/api/wallets/WalletsApiClient';
import { RaceService } from '@/lib/services/races/RaceService';
import { ProtestService } from '@/lib/services/protests/ProtestService';
import { PenaltyService } from '@/lib/services/penalties/PenaltyService';
import { DriverService } from '@/lib/services/drivers/DriverService';
import {
LEAGUE_SERVICE_TOKEN,
LEAGUE_SETTINGS_SERVICE_TOKEN,
LEAGUE_STEWARDING_SERVICE_TOKEN,
LEAGUE_WALLET_SERVICE_TOKEN,
LEAGUE_MEMBERSHIP_SERVICE_TOKEN,
LEAGUE_API_CLIENT_TOKEN,
DRIVER_API_CLIENT_TOKEN,
SPONSOR_API_CLIENT_TOKEN,
RACE_API_CLIENT_TOKEN,
WALLET_API_CLIENT_TOKEN,
RACE_SERVICE_TOKEN,
PROTEST_SERVICE_TOKEN,
PENALTY_SERVICE_TOKEN,
DRIVER_SERVICE_TOKEN
LEAGUE_MEMBERSHIP_SERVICE_TOKEN
} from '../tokens';
export const LeagueModule = new ContainerModule((options) => {
@@ -37,63 +18,36 @@ export const LeagueModule = new ContainerModule((options) => {
// League Service
bind<LeagueService>(LEAGUE_SERVICE_TOKEN)
.toDynamicValue((ctx) => {
const leagueApiClient = ctx.get<LeaguesApiClient>(LEAGUE_API_CLIENT_TOKEN);
const driverApiClient = ctx.get<DriversApiClient>(DRIVER_API_CLIENT_TOKEN);
const sponsorApiClient = ctx.get<SponsorsApiClient>(SPONSOR_API_CLIENT_TOKEN);
const raceApiClient = ctx.get<RacesApiClient>(RACE_API_CLIENT_TOKEN);
return new LeagueService(
leagueApiClient,
driverApiClient,
sponsorApiClient,
raceApiClient
);
.toDynamicValue(() => {
return new LeagueService();
})
.inSingletonScope();
// League Settings Service
bind<LeagueSettingsService>(LEAGUE_SETTINGS_SERVICE_TOKEN)
.toDynamicValue((ctx) => {
const leagueApiClient = ctx.get<LeaguesApiClient>(LEAGUE_API_CLIENT_TOKEN);
const driverApiClient = ctx.get<DriversApiClient>(DRIVER_API_CLIENT_TOKEN);
return new LeagueSettingsService(leagueApiClient, driverApiClient);
.toDynamicValue(() => {
return new LeagueSettingsService();
})
.inSingletonScope();
// League Stewarding Service
bind<LeagueStewardingService>(LEAGUE_STEWARDING_SERVICE_TOKEN)
.toDynamicValue((ctx) => {
const raceService = ctx.get<RaceService>(RACE_SERVICE_TOKEN);
const protestService = ctx.get<ProtestService>(PROTEST_SERVICE_TOKEN);
const penaltyService = ctx.get<PenaltyService>(PENALTY_SERVICE_TOKEN);
const driverService = ctx.get<DriverService>(DRIVER_SERVICE_TOKEN);
const membershipService = ctx.get<LeagueMembershipService>(LEAGUE_MEMBERSHIP_SERVICE_TOKEN);
return new LeagueStewardingService(
raceService,
protestService,
penaltyService,
driverService,
membershipService
);
.toDynamicValue(() => {
return new LeagueStewardingService();
})
.inSingletonScope();
// League Wallet Service
bind<LeagueWalletService>(LEAGUE_WALLET_SERVICE_TOKEN)
.toDynamicValue((ctx) => {
const walletApiClient = ctx.get<WalletsApiClient>(WALLET_API_CLIENT_TOKEN);
return new LeagueWalletService(walletApiClient);
.toDynamicValue(() => {
return new LeagueWalletService();
})
.inSingletonScope();
// League Membership Service
bind<LeagueMembershipService>(LEAGUE_MEMBERSHIP_SERVICE_TOKEN)
.toDynamicValue((ctx) => {
const leagueApiClient = ctx.get<LeaguesApiClient>(LEAGUE_API_CLIENT_TOKEN);
return new LeagueMembershipService(leagueApiClient);
.toDynamicValue(() => {
return new LeagueMembershipService();
})
.inSingletonScope();
});

View File

@@ -1,16 +1,12 @@
import { ContainerModule } from 'inversify';
import { SPONSOR_SERVICE_TOKEN, SPONSOR_API_CLIENT_TOKEN } from '../tokens';
import { SPONSOR_SERVICE_TOKEN } from '../tokens';
import { SponsorService } from '@/lib/services/sponsors/SponsorService';
import { SponsorsApiClient } from '@/lib/api/sponsors/SponsorsApiClient';
export const SponsorModule = new ContainerModule((options) => {
const bind = options.bind;
// Sponsor Service
// Sponsor Service - creates its own dependencies for server safety
bind<SponsorService>(SPONSOR_SERVICE_TOKEN)
.toDynamicValue((ctx) => {
const apiClient = ctx.get<SponsorsApiClient>(SPONSOR_API_CLIENT_TOKEN);
return new SponsorService(apiClient);
})
.inSingletonScope();
.to(SponsorService)
.inTransientScope(); // Not singleton for server concurrency
});

View File

@@ -0,0 +1,23 @@
export class MedalDisplay {
static getColor(position: number): string {
switch (position) {
case 1: return 'text-yellow-400';
case 2: return 'text-gray-300';
case 3: return 'text-amber-600';
default: return 'text-gray-500';
}
}
static getBg(position: number): string {
switch (position) {
case 1: return 'bg-yellow-400/10 border-yellow-400/30';
case 2: return 'bg-gray-300/10 border-gray-300/30';
case 3: return 'bg-amber-600/10 border-amber-600/30';
default: return 'bg-iron-gray/50 border-charcoal-outline';
}
}
static getMedalIcon(position: number): string | null {
return position <= 3 ? '🏆' : null;
}
}

View File

@@ -1,11 +1,5 @@
/**
* RatingDisplay
*
* Deterministic rating formatting for display.
*/
export class RatingDisplay {
static format(rating: number): string {
return rating.toFixed(1);
return rating.toString();
}
}

View File

@@ -0,0 +1,41 @@
export class SkillLevelDisplay {
static getLabel(skillLevel: string): string {
const levels: Record<string, string> = {
pro: 'Pro',
advanced: 'Advanced',
intermediate: 'Intermediate',
beginner: 'Beginner',
};
return levels[skillLevel] || skillLevel;
}
static getColor(skillLevel: string): string {
const colors: Record<string, string> = {
pro: 'text-yellow-400',
advanced: 'text-purple-400',
intermediate: 'text-primary-blue',
beginner: 'text-green-400',
};
return colors[skillLevel] || 'text-gray-400';
}
static getBgColor(skillLevel: string): string {
const colors: Record<string, string> = {
pro: 'bg-yellow-400/10',
advanced: 'bg-purple-400/10',
intermediate: 'bg-primary-blue/10',
beginner: 'bg-green-400/10',
};
return colors[skillLevel] || 'bg-gray-400/10';
}
static getBorderColor(skillLevel: string): string {
const colors: Record<string, string> = {
pro: 'border-yellow-400/30',
advanced: 'border-purple-400/30',
intermediate: 'border-primary-blue/30',
beginner: 'border-green-400/30',
};
return colors[skillLevel] || 'border-gray-400/30';
}
}

View File

@@ -0,0 +1,7 @@
export class WinRateDisplay {
static calculate(racesCompleted: number, wins: number): string {
if (racesCompleted === 0) return '0.0';
const rate = (wins / racesCompleted) * 100;
return rate.toFixed(1);
}
}

View File

@@ -20,7 +20,7 @@ export class DeleteUserMutation implements Mutation<{ userId: string }, void, Mu
// Manual construction: Service creates its own dependencies
const service = new AdminService();
const result = await service.deleteUser(input.userId);
const result = await service.deleteUser();
if (result.isErr()) {
return Result.err(mapToMutationError(result.getError()));

View File

@@ -16,19 +16,19 @@ import { Mutation } from '@/lib/contracts/mutations/Mutation';
*/
export class UpdateUserStatusMutation implements Mutation<{ userId: string; status: string }, void, MutationError> {
async execute(input: { userId: string; status: string }): Promise<Result<void, MutationError>> {
try {
// Manual construction: Service creates its own dependencies
const service = new AdminService();
const result = await service.updateUserStatus(input.userId, input.status);
if (result.isErr()) {
return Result.err(mapToMutationError(result.getError()));
}
return Result.ok(undefined);
} catch (err) {
return Result.err('updateFailed');
}
}
try {
// Manual construction: Service creates its own dependencies
const service = new AdminService();
const result = await service.updateUserStatus(input.userId, input.status);
if (result.isErr()) {
return Result.err(mapToMutationError(result.getError()));
}
return Result.ok(undefined);
} catch (err) {
return Result.err('updateFailed');
}
}
}

View File

@@ -21,7 +21,7 @@ export class CreateLeagueMutation {
const logger = new ConsoleLogger();
const apiClient = new LeaguesApiClient(baseUrl, errorReporter, logger);
this.service = new LeagueService(apiClient);
this.service = new LeagueService();
}
async execute(input: CreateLeagueInputDTO): Promise<Result<string, string>> {

View File

@@ -21,7 +21,7 @@ export class RosterAdminMutation {
const logger = new ConsoleLogger();
const apiClient = new LeaguesApiClient(baseUrl, errorReporter, logger);
this.service = new LeagueService(apiClient);
this.service = new LeagueService();
}
async approveJoinRequest(leagueId: string, joinRequestId: string): Promise<Result<void, string>> {

View File

@@ -22,7 +22,7 @@ export class ScheduleAdminMutation {
const logger = new ConsoleLogger();
const apiClient = new LeaguesApiClient(baseUrl, errorReporter, logger);
this.service = new LeagueService(apiClient);
this.service = new LeagueService();
}
async publishSchedule(leagueId: string, seasonId: string): Promise<Result<void, string>> {

View File

@@ -20,7 +20,7 @@ export class StewardingMutation {
const logger = new ConsoleLogger();
const apiClient = new LeaguesApiClient(baseUrl, errorReporter, logger);
this.service = new LeagueService(apiClient);
this.service = new LeagueService();
}
async applyPenalty(input: {

View File

@@ -20,7 +20,7 @@ export class WalletMutation {
const logger = new ConsoleLogger();
const apiClient = new LeaguesApiClient(baseUrl, errorReporter, logger);
this.service = new LeagueService(apiClient);
this.service = new LeagueService();
}
async withdraw(leagueId: string, amount: number): Promise<Result<void, string>> {

View File

@@ -11,20 +11,14 @@ import { PresentationError, mapToPresentationError } from '@/lib/contracts/page-
* Server-side composition for admin users page.
* Fetches user list from API and transforms to ViewData.
*/
export class AdminUsersPageQuery implements PageQuery<AdminUsersViewData, { search?: string; role?: string; status?: string; page?: number; limit?: number }> {
async execute(query: { search?: string; role?: string; status?: string; page?: number; limit?: number }): Promise<Result<AdminUsersViewData, PresentationError>> {
export class AdminUsersPageQuery implements PageQuery<AdminUsersViewData, void> {
async execute(): Promise<Result<AdminUsersViewData, PresentationError>> {
try {
// Manual construction: Service creates its own dependencies
const adminService = new AdminService();
// Fetch user list via service
const apiDtoResult = await adminService.listUsers({
search: query.search,
role: query.role,
status: query.status,
page: query.page || 1,
limit: query.limit || 50,
});
const apiDtoResult = await adminService.listUsers();
if (apiDtoResult.isErr()) {
return Result.err(mapToPresentationError(apiDtoResult.getError()));
@@ -46,8 +40,8 @@ export class AdminUsersPageQuery implements PageQuery<AdminUsersViewData, { sear
}
// Static method to avoid object construction in server code
static async execute(query: { search?: string; role?: string; status?: string; page?: number; limit?: number }): Promise<Result<AdminUsersViewData, PresentationError>> {
static async execute(): Promise<Result<AdminUsersViewData, PresentationError>> {
const queryInstance = new AdminUsersPageQuery();
return queryInstance.execute(query);
return queryInstance.execute();
}
}

View File

@@ -0,0 +1,38 @@
import { Result } from '@/lib/contracts/Result';
import { PageQuery } from '@/lib/contracts/page-queries/PageQuery';
import { SponsorService } from '@/lib/services/sponsors/SponsorService';
import { SponsorDashboardViewDataBuilder } from '@/lib/builders/view-data/SponsorDashboardViewDataBuilder';
import type { SponsorDashboardViewData } from '@/lib/view-data/SponsorDashboardViewData';
/**
* Sponsor Dashboard Page Query
*
* Composes data for the sponsor dashboard page.
* Maps domain errors to presentation errors.
*/
export class SponsorDashboardPageQuery implements PageQuery<SponsorDashboardViewData, string> {
async execute(sponsorId: string): Promise<Result<SponsorDashboardViewData, string>> {
const service = new SponsorService();
const dashboardResult = await service.getSponsorDashboard(sponsorId);
if (dashboardResult.isErr()) {
return Result.err(this.mapToPresentationError(dashboardResult.getError()));
}
const dto = dashboardResult.unwrap();
const viewData = SponsorDashboardViewDataBuilder.build(dto);
return Result.ok(viewData);
}
private mapToPresentationError(domainError: { type: string }): string {
switch (domainError.type) {
case 'notFound':
return 'Dashboard not found';
case 'notImplemented':
return 'Dashboard feature not yet implemented';
default:
return 'Failed to load dashboard';
}
}
}

View File

@@ -1,26 +1,25 @@
import type { PageQueryResult } from '@/lib/contracts/page-queries/PageQueryResult';
import { Result } from '@/lib/contracts/Result';
import { DriverProfilePageService } from '@/lib/services/drivers/DriverProfilePageService';
import { DriverProfileViewModelBuilder } from '@/lib/builders/view-models/DriverProfileViewModelBuilder';
import type { DriverProfileViewModel } from '@/lib/view-models/DriverProfileViewModel';
import { DriverProfileViewDataBuilder } from '@/lib/builders/view-data/DriverProfileViewDataBuilder';
import type { DriverProfileViewData } from '@/lib/types/view-data/DriverProfileViewData';
/**
* DriverProfilePageQuery
*
* Server-side data fetcher for the driver profile page.
* Returns a discriminated union with all possible page states.
* Uses Service for data access and ViewModelBuilder for transformation.
* Returns Result<ViewData, PresentationError>
* Uses Service for data access and ViewDataBuilder for transformation.
*/
export class DriverProfilePageQuery {
/**
* Execute the driver profile page query
*
* @param driverId - The driver ID to fetch profile for
* @returns PageQueryResult with discriminated union of states
* @returns Result with ViewData or error
*/
static async execute(driverId: string | null): Promise<PageQueryResult<DriverProfileViewModel>> {
// Handle missing driver ID
static async execute(driverId: string | null): Promise<Result<DriverProfileViewData, string>> {
if (!driverId) {
return { status: 'notFound' };
return Result.err('NotFound');
}
try {
@@ -31,26 +30,26 @@ export class DriverProfilePageQuery {
if (result.isErr()) {
const error = result.getError();
if (error === 'notFound') {
return { status: 'notFound' };
return Result.err('NotFound');
}
if (error === 'unauthorized') {
return { status: 'error', errorId: 'UNAUTHORIZED' };
return Result.err('Unauthorized');
}
return { status: 'error', errorId: 'DRIVER_PROFILE_FETCH_FAILED' };
return Result.err('Error');
}
// Build ViewModel from DTO
// Build ViewData from DTO
const dto = result.unwrap();
const viewModel = DriverProfileViewModelBuilder.build(dto);
return { status: 'ok', dto: viewModel };
const viewData = DriverProfileViewDataBuilder.build(dto);
return Result.ok(viewData);
} catch (error) {
console.error('DriverProfilePageQuery failed:', error);
return { status: 'error', errorId: 'DRIVER_PROFILE_FETCH_FAILED' };
return Result.err('Error');
}
}
}

View File

@@ -1,22 +1,22 @@
import type { PageQueryResult } from '@/lib/contracts/page-queries/PageQueryResult';
import { Result } from '@/lib/contracts/Result';
import { DriversPageService } from '@/lib/services/drivers/DriversPageService';
import { DriversViewModelBuilder } from '@/lib/builders/view-models/DriversViewModelBuilder';
import type { DriverLeaderboardViewModel } from '@/lib/view-models/DriverLeaderboardViewModel';
import { DriversViewDataBuilder } from '@/lib/builders/view-data/DriversViewDataBuilder';
import type { DriversViewData } from '@/lib/types/view-data/DriversViewData';
/**
* DriversPageQuery
*
* Server-side data fetcher for the drivers listing page.
* Returns a discriminated union with all possible page states.
* Uses Service for data access and ViewModelBuilder for transformation.
* Returns Result<ViewData, PresentationError>
* Uses Service for data access and ViewDataBuilder for transformation.
*/
export class DriversPageQuery {
/**
* Execute the drivers page query
*
* @returns PageQueryResult with discriminated union of states
* @returns Result with ViewData or error
*/
static async execute(): Promise<PageQueryResult<DriverLeaderboardViewModel>> {
static async execute(): Promise<Result<DriversViewData, string>> {
try {
// Manual wiring: construct dependencies explicitly
const service = new DriversPageService();
@@ -25,22 +25,22 @@ export class DriversPageQuery {
if (result.isErr()) {
const error = result.getError();
if (error === 'notFound') {
return { status: 'notFound' };
return Result.err('NotFound');
}
return { status: 'error', errorId: 'DRIVERS_FETCH_FAILED' };
return Result.err('Error');
}
// Build ViewModel from DTO
// Build ViewData from DTO
const dto = result.unwrap();
const viewModel = DriversViewModelBuilder.build(dto);
return { status: 'ok', dto: viewModel };
const viewData = DriversViewDataBuilder.build(dto);
return Result.ok(viewData);
} catch (error) {
console.error('DriversPageQuery failed:', error);
return { status: 'error', errorId: 'DRIVERS_FETCH_FAILED' };
return Result.err('Error');
}
}
}

View File

@@ -2,10 +2,7 @@ import { PageQuery } from '@/lib/contracts/page-queries/PageQuery';
import { Result } from '@/lib/contracts/Result';
import { LeaguesViewDataBuilder } from '@/lib/builders/view-data/LeaguesViewDataBuilder';
import type { LeaguesViewData } from '@/lib/view-data/LeaguesViewData';
import { LeaguesApiClient } from '@/lib/api/leagues/LeaguesApiClient';
import { DomainError } from '@/lib/contracts/services/Service';
import { ConsoleErrorReporter } from '@/lib/infrastructure/logging/ConsoleErrorReporter';
import { ConsoleLogger } from '@/lib/infrastructure/logging/ConsoleLogger';
import { LeagueService } from '@/lib/services/leagues/LeagueService';
/**
* Leagues page query
@@ -14,40 +11,30 @@ import { ConsoleLogger } from '@/lib/infrastructure/logging/ConsoleLogger';
*/
export class LeaguesPageQuery implements PageQuery<LeaguesViewData, void> {
async execute(): Promise<Result<LeaguesViewData, 'notFound' | 'redirect' | 'LEAGUES_FETCH_FAILED' | 'UNKNOWN_ERROR'>> {
// Manual wiring: create API client
const baseUrl = process.env.NEXT_PUBLIC_API_URL || '';
const errorReporter = new ConsoleErrorReporter();
const logger = new ConsoleLogger();
const apiClient = new LeaguesApiClient(baseUrl, errorReporter, logger);
// Fetch data using API client
try {
const apiDto = await apiClient.getAllWithCapacityAndScoring();
if (!apiDto || !apiDto.leagues) {
return Result.err('notFound');
}
// Transform to ViewData using builder
const viewData = LeaguesViewDataBuilder.build(apiDto);
return Result.ok(viewData);
} catch (error) {
console.error('LeaguesPageQuery failed:', error);
if (error instanceof Error) {
if (error.message.includes('403') || error.message.includes('401')) {
return Result.err('redirect');
}
if (error.message.includes('404')) {
// Manual construction: Service creates its own dependencies
const service = new LeagueService();
// Fetch data using service
const result = await service.getAllLeagues();
if (result.isErr()) {
const error = result.getError();
switch (error.type) {
case 'notFound':
return Result.err('notFound');
}
if (error.message.includes('5') || error.message.includes('server')) {
case 'unauthorized':
case 'forbidden':
return Result.err('redirect');
case 'serverError':
return Result.err('LEAGUES_FETCH_FAILED');
}
default:
return Result.err('UNKNOWN_ERROR');
}
return Result.err('UNKNOWN_ERROR');
}
// Transform to ViewData using builder
const viewData = LeaguesViewDataBuilder.build(result.unwrap());
return Result.ok(viewData);
}
// Static method to avoid object construction in server code

View File

@@ -1,5 +1,5 @@
import { AdminApiClient } from '@/lib/api/admin/AdminApiClient';
import type { UserDto, DashboardStats, UserListResponse, ListUsersQuery } from '@/lib/api/admin/AdminApiClient';
import type { UserDto, DashboardStats, UserListResponse } from '@/lib/types/admin';
import { Result } from '@/lib/contracts/Result';
import { ConsoleLogger } from '@/lib/infrastructure/logging/ConsoleLogger';
import { EnhancedErrorReporter } from '@/lib/infrastructure/EnhancedErrorReporter';
@@ -30,82 +30,103 @@ export class AdminService implements Service {
}
/**
* Get dashboard statistics
*/
async getDashboardStats(): Promise<Result<DashboardStats, DomainError>> {
try {
const result = await this.apiClient.getDashboardStats();
return Result.ok(result);
} catch (error) {
console.error('AdminService.getDashboardStats failed:', error);
if (error instanceof Error) {
if (error.message.includes('403') || error.message.includes('401')) {
return Result.err({ type: 'notFound', message: 'Access denied' });
}
}
return Result.err({ type: 'serverError', message: 'Failed to fetch dashboard stats' });
}
}
* Get dashboard statistics
*/
async getDashboardStats(): Promise<Result<DashboardStats, DomainError>> {
// Mock data until API is implemented
const mockStats: DashboardStats = {
totalUsers: 1250,
activeUsers: 1100,
suspendedUsers: 50,
deletedUsers: 100,
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' },
],
statusDistribution: {
active: 1100,
suspended: 50,
deleted: 100,
},
activityTimeline: [
{ date: '2024-01-01', newUsers: 10, logins: 200 },
{ date: '2024-01-02', newUsers: 15, logins: 220 },
],
};
return Result.ok(mockStats);
}
/**
* List users with filtering and pagination
*/
async listUsers(query: ListUsersQuery = {}): Promise<Result<UserListResponse, DomainError>> {
try {
const result = await this.apiClient.listUsers(query);
return Result.ok(result);
} catch (error) {
console.error('AdminService.listUsers failed:', error);
if (error instanceof Error) {
if (error.message.includes('403') || error.message.includes('401')) {
return Result.err({ type: 'notFound', message: 'Access denied' });
}
}
return Result.err({ type: 'serverError', message: 'Failed to fetch users' });
}
}
* List users with filtering and pagination
*/
async listUsers(): Promise<Result<UserListResponse, DomainError>> {
// Mock data until API is implemented
const mockUsers: UserDto[] = [
{
id: '1',
email: 'admin@example.com',
displayName: 'Admin User',
roles: ['owner', 'admin'],
status: 'active',
isSystemAdmin: true,
createdAt: '2024-01-01T00:00:00.000Z',
updatedAt: '2024-01-01T00:00:00.000Z',
lastLoginAt: '2024-01-15T10:00:00.000Z',
primaryDriverId: 'driver-1',
},
{
id: '2',
email: 'user@example.com',
displayName: 'Regular User',
roles: ['user'],
status: 'active',
isSystemAdmin: false,
createdAt: '2024-01-02T00:00:00.000Z',
updatedAt: '2024-01-02T00:00:00.000Z',
lastLoginAt: '2024-01-14T15:00:00.000Z',
},
];
const mockResponse: UserListResponse = {
users: mockUsers,
total: 2,
page: 1,
limit: 50,
totalPages: 1,
};
return Result.ok(mockResponse);
}
/**
* Update user status
*/
async updateUserStatus(userId: string, status: string): Promise<Result<UserDto, DomainError>> {
try {
const result = await this.apiClient.updateUserStatus(userId, status);
return Result.ok(result);
} catch (error) {
console.error('AdminService.updateUserStatus failed:', error);
if (error instanceof Error) {
if (error.message.includes('403') || error.message.includes('401')) {
return Result.err({ type: 'forbidden', message: 'Insufficient permissions' });
}
}
return Result.err({ type: 'serverError', message: 'Failed to update user status' });
}
}
* Update user status
*/
async updateUserStatus(userId: string, status: string): Promise<Result<UserDto, DomainError>> {
// Mock success until API is implemented
return Result.ok({
id: userId,
email: 'mock@example.com',
displayName: 'Mock User',
roles: ['user'],
status,
isSystemAdmin: false,
createdAt: '2024-01-01T00:00:00.000Z',
updatedAt: '2024-01-01T00:00:00.000Z',
});
}
/**
* Delete a user (soft delete)
*/
async deleteUser(userId: string): Promise<Result<void, DomainError>> {
try {
await this.apiClient.deleteUser(userId);
return Result.ok(undefined);
} catch (error) {
console.error('AdminService.deleteUser failed:', error);
if (error instanceof Error) {
if (error.message.includes('403') || error.message.includes('401')) {
return Result.err({ type: 'forbidden', message: 'Insufficient permissions' });
}
}
return Result.err({ type: 'serverError', message: 'Failed to delete user' });
}
}
* Delete a user (soft delete)
*/
async deleteUser(): Promise<Result<void, DomainError>> {
// Mock success until API is implemented
return Result.ok(undefined);
}
}

View File

@@ -1,17 +1,38 @@
import { Result } from '@/lib/contracts/Result';
import type { Service } from '@/lib/contracts/services/Service';
import type { GetLiveriesOutputDTO } from '@/lib/types/tbd/GetLiveriesOutputDTO';
/**
* Livery Service
*
* Currently not implemented - returns NotImplemented errors for all endpoints.
*
* Provides livery management functionality.
*/
export class LiveryService implements Service {
async getLiveries(): Promise<Result<void, 'NOT_IMPLEMENTED'>> {
return Result.err('NOT_IMPLEMENTED');
async getLiveries(driverId: string): Promise<Result<GetLiveriesOutputDTO, string>> {
// Mock data for now
const mockLiveries: GetLiveriesOutputDTO = {
liveries: [
{
id: 'livery-1',
name: 'Default Livery',
imageUrl: '/mock-livery-1.png',
createdAt: new Date().toISOString(),
isActive: true,
},
{
id: 'livery-2',
name: 'Custom Livery',
imageUrl: '/mock-livery-2.png',
createdAt: new Date(Date.now() - 86400000).toISOString(),
isActive: false,
},
],
};
return Result.ok(mockLiveries);
}
async uploadLivery(): Promise<Result<void, 'NOT_IMPLEMENTED'>> {
return Result.err('NOT_IMPLEMENTED');
async uploadLivery(driverId: string, file: File): Promise<Result<{ liveryId: string }, string>> {
// Mock implementation
return Result.ok({ liveryId: 'new-livery-id' });
}
}

View File

@@ -1,18 +1,11 @@
import { DriversApiClient } from '@/lib/api/drivers/DriversApiClient';
import { TeamsApiClient } from '@/lib/api/teams/TeamsApiClient';
import { Result } from '@/lib/contracts/Result';
import { Service, DomainError } from '@/lib/contracts/services/Service';
import { ConsoleErrorReporter } from '@/lib/infrastructure/logging/ConsoleErrorReporter';
import { ConsoleLogger } from '@/lib/infrastructure/logging/ConsoleLogger';
import type { DriverLeaderboardItemDTO } from '@/lib/types/generated/DriverLeaderboardItemDTO';
import type { TeamListItemDTO } from '@/lib/types/generated/TeamListItemDTO';
import { getWebsiteApiBaseUrl } from '@/lib/config/apiBaseUrl';
import { ApiError } from '@/lib/api/base/ApiError';
export interface LeaderboardsData {
drivers: { drivers: DriverLeaderboardItemDTO[] };
teams: { teams: TeamListItemDTO[] };
}
import type { LeaderboardsData } from '@/lib/types/LeaderboardsData';
export class LeaderboardsService implements Service {
async getLeaderboards(): Promise<Result<LeaderboardsData, DomainError>> {
@@ -20,33 +13,20 @@ export class LeaderboardsService implements Service {
const baseUrl = getWebsiteApiBaseUrl();
const errorReporter = new ConsoleErrorReporter();
const logger = new ConsoleLogger();
const driversApiClient = new DriversApiClient(baseUrl, errorReporter, logger);
const teamsApiClient = new TeamsApiClient(baseUrl, errorReporter, logger);
const [driverResult, teamResult] = await Promise.all([
driversApiClient.getLeaderboard(),
teamsApiClient.getAll(),
]);
if (!driverResult && !teamResult) {
const driverResult = await driversApiClient.getLeaderboard();
if (!driverResult) {
return Result.err({ type: 'notFound', message: 'No leaderboard data available' });
}
// Check if team ranking is needed but not provided by API
// TeamListItemDTO does not have a rank field, so we cannot provide ranked team data
if (teamResult && teamResult.teams.length > 0) {
const hasRankField = teamResult.teams.some(team => 'rank' in team);
if (!hasRankField) {
return Result.err({ type: 'serverError', message: 'Team ranking not implemented' });
}
}
const data: LeaderboardsData = {
drivers: driverResult || { drivers: [] },
teams: teamResult || { teams: [] },
drivers: driverResult,
teams: { teams: [] }, // Teams leaderboard not implemented
};
return Result.ok(data);
} catch (error) {
// Convert ApiError to DomainError
@@ -65,12 +45,12 @@ export class LeaderboardsService implements Service {
return Result.err({ type: 'unknown', message: error.message });
}
}
// Handle non-ApiError cases
if (error instanceof Error) {
return Result.err({ type: 'unknown', message: error.message });
}
return Result.err({ type: 'unknown', message: 'Leaderboards fetch failed' });
}
}

View File

@@ -6,10 +6,7 @@ import { CreateLeagueInputDTO } from "@/lib/types/generated/CreateLeagueInputDTO
import { CreateLeagueOutputDTO } from "@/lib/types/generated/CreateLeagueOutputDTO";
import type { MembershipRole } from "@/lib/types/MembershipRole";
import type { LeagueRosterJoinRequestDTO } from "@/lib/types/generated/LeagueRosterJoinRequestDTO";
import type { RaceDTO } from "@/lib/types/generated/RaceDTO";
import type { TotalLeaguesDTO } from '@/lib/types/generated/TotalLeaguesDTO';
import type { LeagueScoringConfigDTO } from "@/lib/types/generated/LeagueScoringConfigDTO";
import type { LeagueMembership } from "@/lib/types/LeagueMembership";
import type { LeagueSeasonSummaryDTO } from '@/lib/types/generated/LeagueSeasonSummaryDTO';
import type { LeagueScheduleDTO } from '@/lib/types/generated/LeagueScheduleDTO';
import type { CreateLeagueScheduleRaceInputDTO } from '@/lib/types/generated/CreateLeagueScheduleRaceInputDTO';
@@ -19,27 +16,52 @@ import type { LeagueScheduleRaceMutationSuccessDTO } from '@/lib/types/generated
import type { LeagueSeasonSchedulePublishOutputDTO } from '@/lib/types/generated/LeagueSeasonSchedulePublishOutputDTO';
import type { LeagueRosterMemberDTO } from '@/lib/types/generated/LeagueRosterMemberDTO';
import type { LeagueMembershipsDTO } from '@/lib/types/generated/LeagueMembershipsDTO';
import { Result } from '@/lib/contracts/Result';
import { DomainError, Service } from '@/lib/contracts/services/Service';
import { ConsoleLogger } from '@/lib/infrastructure/logging/ConsoleLogger';
import { EnhancedErrorReporter } from '@/lib/infrastructure/EnhancedErrorReporter';
import { getWebsiteApiBaseUrl } from '@/lib/config/apiBaseUrl';
import { getWebsiteServerEnv } from '@/lib/config/env';
import { AllLeaguesWithCapacityAndScoringDTO } from '@/lib/types/AllLeaguesWithCapacityAndScoringDTO';
/**
* League Service - DTO Only
*
* Returns raw API DTOs. No ViewModels or UX logic.
* Returns Result<ApiDto, DomainError>. No ViewModels or UX logic.
* All client-side presentation logic must be handled by hooks/components.
* @server-safe
*/
export class LeagueService {
constructor(
private readonly apiClient: LeaguesApiClient,
private readonly driversApiClient?: DriversApiClient,
private readonly sponsorsApiClient?: SponsorsApiClient,
private readonly racesApiClient?: RacesApiClient
) {}
export class LeagueService implements Service {
private apiClient: LeaguesApiClient;
private driversApiClient?: DriversApiClient;
private sponsorsApiClient?: SponsorsApiClient;
private racesApiClient?: RacesApiClient;
async getAllLeagues(): Promise<any> {
return this.apiClient.getAllWithCapacityAndScoring();
constructor() {
const baseUrl = getWebsiteApiBaseUrl();
const logger = new ConsoleLogger();
const { NODE_ENV } = getWebsiteServerEnv();
const errorReporter = new EnhancedErrorReporter(logger, {
showUserNotifications: false,
logToConsole: true,
reportToExternal: NODE_ENV === 'production',
});
this.apiClient = new LeaguesApiClient(baseUrl, errorReporter, logger);
// Optional clients can be initialized if needed
}
async getLeagueStandings(leagueId: string): Promise<any> {
return this.apiClient.getStandings(leagueId);
async getAllLeagues(): Promise<Result<AllLeaguesWithCapacityAndScoringDTO, DomainError>> {
try {
const dto = await this.apiClient.getAllWithCapacityAndScoring();
return Result.ok(dto);
} catch (error) {
console.error('LeagueService.getAllLeagues failed:', error);
return Result.err({ type: 'serverError', message: 'Failed to fetch leagues' });
}
}
async getLeagueStandings(): Promise<Result<never, DomainError>> {
return Result.err({ type: 'notImplemented', message: 'League standings endpoint not implemented' });
}
async getLeagueStats(): Promise<TotalLeaguesDTO> {
@@ -166,16 +188,15 @@ export class LeagueService {
return { success: dto.success };
}
async getLeagueDetail(leagueId: string): Promise<any> {
return this.apiClient.getAllWithCapacityAndScoring();
async getLeagueDetail(): Promise<Result<never, DomainError>> {
return Result.err({ type: 'notImplemented', message: 'League detail endpoint not implemented' });
}
async getLeagueDetailPageData(leagueId: string): Promise<any> {
return this.apiClient.getAllWithCapacityAndScoring();
async getLeagueDetailPageData(): Promise<Result<never, DomainError>> {
return Result.err({ type: 'notImplemented', message: 'League detail page data endpoint not implemented' });
}
async getScoringPresets(): Promise<any[]> {
const result = await this.apiClient.getScoringPresets();
return result.presets;
async getScoringPresets(): Promise<Result<never, DomainError>> {
return Result.err({ type: 'notImplemented', message: 'Scoring presets endpoint not implemented' });
}
}

View File

@@ -1,5 +1,18 @@
import { Result } from '@/lib/contracts/Result';
import { DomainError } from '@/lib/contracts/services/Service';
import { DomainError, Service } from '@/lib/contracts/services/Service';
import { SponsorsApiClient } from '@/lib/api/sponsors/SponsorsApiClient';
import { ConsoleLogger } from '@/lib/infrastructure/logging/ConsoleLogger';
import { EnhancedErrorReporter } from '@/lib/infrastructure/EnhancedErrorReporter';
import { getWebsiteApiBaseUrl } from '@/lib/config/apiBaseUrl';
import { getWebsiteServerEnv } from '@/lib/config/env';
import type { SponsorDashboardDTO } from '@/lib/types/generated/SponsorDashboardDTO';
import type { SponsorSponsorshipsDTO } from '@/lib/types/generated/SponsorSponsorshipsDTO';
import type { GetSponsorOutputDTO } from '@/lib/types/generated/GetSponsorOutputDTO';
import type { GetPendingSponsorshipRequestsOutputDTO } from '@/lib/types/generated/GetPendingSponsorshipRequestsOutputDTO';
import type { SponsorBillingDTO } from '@/lib/types/tbd/SponsorBillingDTO';
import type { AvailableLeaguesDTO } from '@/lib/types/tbd/AvailableLeaguesDTO';
import type { LeagueDetailForSponsorDTO } from '@/lib/types/tbd/LeagueDetailForSponsorDTO';
import type { SponsorSettingsDTO } from '@/lib/types/tbd/SponsorSettingsDTO';
/**
* Sponsor Service - DTO Only
@@ -7,100 +20,96 @@ 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 SponsorService {
constructor(private readonly apiClient: any) {}
export class SponsorService implements Service {
private apiClient: SponsorsApiClient;
async getSponsorById(sponsorId: string): Promise<Result<any, DomainError>> {
constructor() {
const baseUrl = getWebsiteApiBaseUrl();
const logger = new ConsoleLogger();
const { NODE_ENV } = getWebsiteServerEnv();
const errorReporter = new EnhancedErrorReporter(logger, {
showUserNotifications: true,
logToConsole: true,
reportToExternal: NODE_ENV === 'production',
});
this.apiClient = new SponsorsApiClient(baseUrl, errorReporter, logger);
}
async getSponsorById(sponsorId: string): Promise<Result<GetSponsorOutputDTO, DomainError>> {
try {
const result = await this.apiClient.getSponsor(sponsorId);
if (!result) {
return Result.err({ type: 'notFound', message: 'Sponsor not found' });
}
return Result.ok(result);
} catch (error) {
return Result.err({ type: 'notImplemented', message: 'getSponsorById' });
return Result.err({ type: 'unknown', message: 'Failed to get sponsor' });
}
}
async getSponsorDashboard(sponsorId: string): Promise<Result<any, DomainError>> {
async getSponsorDashboard(sponsorId: string): Promise<Result<SponsorDashboardDTO, DomainError>> {
try {
const result = await this.apiClient.getDashboard(sponsorId);
if (!result) {
return Result.err({ type: 'notFound', message: 'Dashboard not found' });
}
return Result.ok(result);
} catch (error) {
return Result.err({ type: 'notImplemented', message: 'getSponsorDashboard' });
}
}
async getSponsorSponsorships(sponsorId: string): Promise<Result<any, DomainError>> {
async getSponsorSponsorships(sponsorId: string): Promise<Result<SponsorSponsorshipsDTO, DomainError>> {
try {
const result = await this.apiClient.getSponsorships(sponsorId);
if (!result) {
return Result.err({ type: 'notFound', message: 'Sponsorships not found' });
}
return Result.ok(result);
} catch (error) {
return Result.err({ type: 'notImplemented', message: 'getSponsorSponsorships' });
}
}
async getBilling(sponsorId: string): Promise<Result<any, DomainError>> {
try {
const result = await this.apiClient.getBilling(sponsorId);
return Result.ok(result);
} catch (error) {
return Result.err({ type: 'notImplemented', message: 'getBilling' });
}
async getBilling(): Promise<Result<SponsorBillingDTO, DomainError>> {
return Result.err({ type: 'notImplemented', message: 'getBilling' });
}
async getAvailableLeagues(): Promise<Result<any, DomainError>> {
try {
const result = await this.apiClient.getAvailableLeagues();
return Result.ok(result);
} catch (error) {
return Result.err({ type: 'notImplemented', message: 'getAvailableLeagues' });
}
async getAvailableLeagues(): Promise<Result<AvailableLeaguesDTO, DomainError>> {
return Result.err({ type: 'notImplemented', message: 'getAvailableLeagues' });
}
async getLeagueDetail(leagueId: string): Promise<Result<any, DomainError>> {
try {
const result = await this.apiClient.getLeagueDetail(leagueId);
return Result.ok(result);
} catch (error) {
return Result.err({ type: 'notImplemented', message: 'getLeagueDetail' });
}
async getLeagueDetail(): Promise<Result<LeagueDetailForSponsorDTO, DomainError>> {
return Result.err({ type: 'notImplemented', message: 'getLeagueDetail' });
}
async getSettings(sponsorId: string): Promise<Result<any, DomainError>> {
try {
const result = await this.apiClient.getSettings(sponsorId);
return Result.ok(result);
} catch (error) {
return Result.err({ type: 'notImplemented', message: 'getSettings' });
}
async getSettings(): Promise<Result<SponsorSettingsDTO, DomainError>> {
return Result.err({ type: 'notImplemented', message: 'getSettings' });
}
async updateSettings(sponsorId: string, input: any): Promise<Result<void, DomainError>> {
try {
await this.apiClient.updateSettings(sponsorId, input);
return Result.ok(undefined);
} catch (error) {
return Result.err({ type: 'notImplemented', message: 'updateSettings' });
}
async updateSettings(): Promise<Result<void, DomainError>> {
return Result.err({ type: 'notImplemented', message: 'updateSettings' });
}
async acceptSponsorshipRequest(requestId: string, sponsorId: string): Promise<Result<void, DomainError>> {
try {
await this.apiClient.acceptSponsorshipRequest(requestId, sponsorId);
await this.apiClient.acceptSponsorshipRequest(requestId, { respondedBy: sponsorId });
return Result.ok(undefined);
} catch (error) {
return Result.err({ type: 'notImplemented', message: 'acceptSponsorshipRequest' });
return Result.err({ type: 'unknown', message: 'Failed to accept sponsorship request' });
}
}
async rejectSponsorshipRequest(requestId: string, sponsorId: string, reason?: string): Promise<Result<void, DomainError>> {
try {
await this.apiClient.rejectSponsorshipRequest(requestId, sponsorId, reason);
await this.apiClient.rejectSponsorshipRequest(requestId, { respondedBy: sponsorId, reason });
return Result.ok(undefined);
} catch (error) {
return Result.err({ type: 'notImplemented', message: 'rejectSponsorshipRequest' });
return Result.err({ type: 'unknown', message: 'Failed to reject sponsorship request' });
}
}
async getPendingSponsorshipRequests(input: any): Promise<Result<any, DomainError>> {
async getPendingSponsorshipRequests(input: { entityType: string; entityId: string }): Promise<Result<GetPendingSponsorshipRequestsOutputDTO, DomainError>> {
try {
const result = await this.apiClient.getPendingSponsorshipRequests(input);
return Result.ok(result);

View File

@@ -27,10 +27,10 @@ export class TeamService implements Service {
this.apiClient = new TeamsApiClient(baseUrl, errorReporter, logger);
}
async getAllTeams(): Promise<Result<TeamSummaryViewModel[], DomainError>> {
async getAllTeams(): Promise<Result<TeamListItemDTO[], DomainError>> {
try {
const result = await this.apiClient.getAll();
return Result.ok(result.teams.map(team => new TeamSummaryViewModel(team)));
return Result.ok(result.teams);
} catch (error) {
return Result.err({ type: 'unknown', message: 'Failed to fetch teams' });
}

View File

@@ -0,0 +1,6 @@
import type { DriverLeaderboardItemDTO } from '@/lib/types/generated/DriverLeaderboardItemDTO';
export interface LeaderboardsData {
drivers: { drivers: DriverLeaderboardItemDTO[] };
teams: { teams: [] };
}

View File

@@ -0,0 +1,7 @@
// Re-export TBD DTOs for admin functionality
export type {
AdminUserDto as UserDto,
AdminUserListResponseDto as UserListResponse,
AdminListUsersQueryDto as ListUsersQuery,
AdminDashboardStatsDto as DashboardStats,
} from './tbd/AdminUserDto';

View File

@@ -0,0 +1,76 @@
/**
* AdminUserDto - TBD DTO for admin user data
*
* This DTO represents the shape of user data returned by admin endpoints.
* TODO: Generate this from API OpenAPI spec when admin endpoints are implemented.
*/
export interface AdminUserDto {
id: string;
email: string;
displayName: string;
roles: string[];
status: string;
isSystemAdmin: boolean;
createdAt: string; // ISO date string
updatedAt: string; // ISO date string
lastLoginAt?: string; // ISO date string
primaryDriverId?: string;
}
/**
* AdminUserListResponseDto - TBD DTO for user list response
*/
export interface AdminUserListResponseDto {
users: AdminUserDto[];
total: number;
page: number;
limit: number;
totalPages: number;
}
/**
* AdminDashboardStatsDto - TBD DTO for dashboard statistics
*/
export interface AdminDashboardStatsDto {
totalUsers: number;
activeUsers: number;
suspendedUsers: number;
deletedUsers: number;
systemAdmins: number;
recentLogins: number;
newUsersToday: number;
userGrowth: {
label: string;
value: number;
color: string;
}[];
roleDistribution: {
label: string;
value: number;
color: string;
}[];
statusDistribution: {
active: number;
suspended: number;
deleted: number;
};
activityTimeline: {
date: string;
newUsers: number;
logins: number;
}[];
}
/**
* AdminListUsersQueryDto - TBD DTO for user list query parameters
*/
export interface AdminListUsersQueryDto {
role?: string;
status?: string;
email?: string;
search?: string;
page?: number;
limit?: number;
sortBy?: 'email' | 'displayName' | 'createdAt' | 'lastLoginAt' | 'status';
sortDirection?: 'asc' | 'desc';
}

View File

@@ -0,0 +1,23 @@
export interface AvailableLeaguesDTO {
leagues: AvailableLeagueDTO[];
}
export interface AvailableLeagueDTO {
id: string;
name: string;
description: string;
drivers: number;
mainSponsorSlot: {
available: boolean;
price: number;
};
secondarySlots: {
available: number;
price: number;
};
cpm: number;
season: {
startDate: string;
endDate: string;
};
}

View File

@@ -0,0 +1,34 @@
/**
* Filtered Races Page Data DTO
*
* API response for filtered races page data with status, time, and league filters.
* Used when the API supports filtering parameters.
*/
export interface FilteredRacesPageDataDTO {
races: FilteredRacesPageDataRaceDTO[];
totalCount: number;
scheduledRaces: FilteredRacesPageDataRaceDTO[];
runningRaces: FilteredRacesPageDataRaceDTO[];
completedRaces: FilteredRacesPageDataRaceDTO[];
filters: {
statuses: { value: string; label: string }[];
leagues: { id: string; name: string }[];
timeFilters: { value: string; label: string }[];
};
}
export interface FilteredRacesPageDataRaceDTO {
id: string;
track: string;
car: string;
scheduledAt: string;
status: 'scheduled' | 'running' | 'completed' | 'cancelled';
sessionType: string;
leagueId?: string;
leagueName?: string;
strengthOfField?: number;
isUpcoming: boolean;
isLive: boolean;
isPast: boolean;
}

View File

@@ -0,0 +1,9 @@
export interface GetLiveriesOutputDTO {
liveries: Array<{
id: string;
name: string;
imageUrl: string;
createdAt: string;
isActive: boolean;
}>;
}

View File

@@ -0,0 +1,41 @@
export interface LeagueDetailForSponsorDTO {
league: LeagueDetailDTO;
drivers: SponsorDriverDTO[];
races: SponsorRaceDTO[];
}
export interface LeagueDetailDTO {
id: string;
name: string;
description: string;
drivers: number;
mainSponsorSlot: {
available: boolean;
price: number;
};
secondarySlots: {
available: number;
price: number;
};
cpm: number;
season: {
startDate: string;
endDate: string;
};
}
export interface SponsorDriverDTO {
id: string;
name: string;
rating: number;
car: string;
sponsorshipPrice: number;
}
export interface SponsorRaceDTO {
id: string;
name: string;
date: string;
track: string;
sponsorshipPrice: number;
}

View File

@@ -0,0 +1,40 @@
export interface SponsorBillingDTO {
sponsorId: string;
paymentMethods: PaymentMethodDTO[];
invoices: InvoiceDTO[];
stats: BillingStatsDTO;
}
export interface PaymentMethodDTO {
id: string;
type: 'card' | 'bank' | 'sepa';
last4: string;
brand?: string;
isDefault: boolean;
expiryMonth?: number;
expiryYear?: number;
bankName?: string;
}
export interface InvoiceDTO {
id: string;
invoiceNumber: string;
date: string;
dueDate: string;
amount: number;
vatAmount: number;
totalAmount: number;
status: 'paid' | 'pending' | 'overdue' | 'failed';
description: string;
sponsorshipType: 'league' | 'team' | 'driver' | 'race' | 'platform';
pdfUrl: string;
}
export interface BillingStatsDTO {
totalSpent: number;
pendingAmount: number;
nextPaymentDate: string;
nextPaymentAmount: number;
activeSponsorships: number;
averageMonthlySpend: number;
}

View File

@@ -0,0 +1,36 @@
export interface SponsorSettingsDTO {
profile: SponsorProfileDTO;
notifications: NotificationSettingsDTO;
}
export interface SponsorProfileDTO {
companyName: string;
contactName: string;
contactEmail: string;
contactPhone: string;
website: string;
description: string;
logoUrl: string | null;
industry: string;
address: {
street: string;
city: string;
country: string;
postalCode: string;
};
taxId: string;
socialLinks: {
twitter: string;
linkedin: string;
instagram: string;
};
}
export interface NotificationSettingsDTO {
emailNewSponsorships: boolean;
emailWeeklyReport: boolean;
emailRaceAlerts: boolean;
emailPaymentAlerts: boolean;
emailNewOpportunities: boolean;
emailContractExpiry: boolean;
}

View File

@@ -0,0 +1,14 @@
export interface TeamsLeaderboardItemDTO {
id: string;
name: string;
tag: string;
memberCount: number;
category?: string;
totalWins: number;
logoUrl?: string;
rank: number;
}
export interface TeamsLeaderboardDto {
teams: TeamsLeaderboardItemDTO[];
}

View File

@@ -0,0 +1,19 @@
export interface DriversViewData {
drivers: {
id: string;
name: string;
rating: number;
skillLevel: string;
category?: string;
nationality: string;
racesCompleted: number;
wins: number;
podiums: number;
isActive: boolean;
rank: number;
avatarUrl?: string;
}[];
totalRaces: number;
totalWins: number;
activeCount: number;
}

View File

@@ -0,0 +1,146 @@
/**
* Auth Validation Utilities
*
* Pure functions for client-side validation of auth forms.
* No side effects, synchronous.
*/
export interface SignupFormData {
firstName: string;
lastName: string;
email: string;
password: string;
confirmPassword: string;
}
export interface ForgotPasswordFormData {
email: string;
}
export interface ResetPasswordFormData {
newPassword: string;
confirmPassword: string;
}
export interface SignupValidationError {
field: keyof SignupFormData;
message: string;
}
export interface ForgotPasswordValidationError {
field: keyof ForgotPasswordFormData;
message: string;
}
export interface ResetPasswordValidationError {
field: keyof ResetPasswordFormData;
message: string;
}
export class SignupFormValidation {
static validateForm(data: SignupFormData): SignupValidationError[] {
const errors: SignupValidationError[] = [];
// First name
if (!data.firstName.trim()) {
errors.push({ field: 'firstName', message: 'First name is required' });
} else if (data.firstName.trim().length < 2) {
errors.push({ field: 'firstName', message: 'First name must be at least 2 characters' });
}
// Last name
if (!data.lastName.trim()) {
errors.push({ field: 'lastName', message: 'Last name is required' });
} else if (data.lastName.trim().length < 2) {
errors.push({ field: 'lastName', message: 'Last name must be at least 2 characters' });
}
// Email
if (!data.email.trim()) {
errors.push({ field: 'email', message: 'Email is required' });
} else if (!this.isValidEmail(data.email)) {
errors.push({ field: 'email', message: 'Please enter a valid email address' });
}
// Password
if (!data.password) {
errors.push({ field: 'password', message: 'Password is required' });
} else if (data.password.length < 8) {
errors.push({ field: 'password', message: 'Password must be at least 8 characters' });
} else if (!this.hasValidPasswordComplexity(data.password)) {
errors.push({ field: 'password', message: 'Password must contain at least one uppercase letter, one lowercase letter, and one number' });
}
// Confirm password
if (!data.confirmPassword) {
errors.push({ field: 'confirmPassword', message: 'Please confirm your password' });
} else if (data.password !== data.confirmPassword) {
errors.push({ field: 'confirmPassword', message: 'Passwords do not match' });
}
return errors;
}
static generateDisplayName(firstName: string, lastName: string): string {
const trimmedFirst = firstName.trim();
const trimmedLast = lastName.trim();
return `${trimmedFirst} ${trimmedLast}`.trim() || trimmedFirst || trimmedLast;
}
private static isValidEmail(email: string): boolean {
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return emailRegex.test(email);
}
private static hasValidPasswordComplexity(password: string): boolean {
return /[a-z]/.test(password) && /[A-Z]/.test(password) && /\d/.test(password);
}
}
export class ForgotPasswordFormValidation {
static validateForm(data: ForgotPasswordFormData): ForgotPasswordValidationError[] {
const errors: ForgotPasswordValidationError[] = [];
// Email
if (!data.email.trim()) {
errors.push({ field: 'email', message: 'Email is required' });
} else if (!this.isValidEmail(data.email)) {
errors.push({ field: 'email', message: 'Please enter a valid email address' });
}
return errors;
}
private static isValidEmail(email: string): boolean {
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return emailRegex.test(email);
}
}
export class ResetPasswordFormValidation {
static validateForm(data: ResetPasswordFormData): ResetPasswordValidationError[] {
const errors: ResetPasswordValidationError[] = [];
// New password
if (!data.newPassword) {
errors.push({ field: 'newPassword', message: 'New password is required' });
} else if (data.newPassword.length < 8) {
errors.push({ field: 'newPassword', message: 'Password must be at least 8 characters' });
} else if (!this.hasValidPasswordComplexity(data.newPassword)) {
errors.push({ field: 'newPassword', message: 'Password must contain at least one uppercase letter, one lowercase letter, and one number' });
}
// Confirm password
if (!data.confirmPassword) {
errors.push({ field: 'confirmPassword', message: 'Please confirm your new password' });
} else if (data.newPassword !== data.confirmPassword) {
errors.push({ field: 'confirmPassword', message: 'Passwords do not match' });
}
return errors;
}
private static hasValidPasswordComplexity(password: string): boolean {
return /[a-z]/.test(password) && /[A-Z]/.test(password) && /\d/.test(password);
}
}

View File

@@ -4,6 +4,6 @@
* ViewData for avatar media rendering.
*/
export interface AvatarViewData {
buffer: ArrayBuffer;
buffer: string; // base64 encoded
contentType: string;
}

View File

@@ -4,6 +4,6 @@
* ViewData for category icon media rendering.
*/
export interface CategoryIconViewData {
buffer: ArrayBuffer;
buffer: string; // base64 encoded
contentType: string;
}

View File

@@ -4,6 +4,6 @@
* ViewData for league cover media rendering.
*/
export interface LeagueCoverViewData {
buffer: ArrayBuffer;
buffer: string; // base64 encoded
contentType: string;
}

View File

@@ -4,6 +4,6 @@
* ViewData for league logo media rendering.
*/
export interface LeagueLogoViewData {
buffer: ArrayBuffer;
buffer: string; // base64 encoded
contentType: string;
}

View File

@@ -0,0 +1,23 @@
export interface SponsorDashboardViewData {
sponsorName: string;
totalImpressions: string;
totalInvestment: string;
metrics: {
impressionsChange: number;
viewersChange: number;
exposureChange: number;
};
categoryData: {
leagues: { count: number; impressions: number };
teams: { count: number; impressions: number };
drivers: { count: number; impressions: number };
races: { count: number; impressions: number };
platform: { count: number; impressions: number };
};
sponsorships: Record<string, unknown>; // From DTO
activeSponsorships: number;
formattedTotalInvestment: string;
costPerThousandViews: string;
upcomingRenewals: any[];
recentActivity: any[];
}

View File

@@ -4,6 +4,6 @@
* ViewData for sponsor logo media rendering.
*/
export interface SponsorLogoViewData {
buffer: ArrayBuffer;
buffer: string; // base64 encoded
contentType: string;
}

View File

@@ -4,6 +4,6 @@
* ViewData for team logo media rendering.
*/
export interface TeamLogoViewData {
buffer: ArrayBuffer;
buffer: string; // base64 encoded
contentType: string;
}

View File

@@ -4,6 +4,6 @@
* ViewData for track image media rendering.
*/
export interface TrackImageViewData {
buffer: ArrayBuffer;
buffer: string; // base64 encoded
contentType: string;
}

View File

@@ -1,4 +1,4 @@
import type { UserDto } from '@/lib/api/admin/AdminApiClient';
import type { UserDto } from '@/lib/types/admin';
/**
* AdminUserViewModel

View File

@@ -1,47 +0,0 @@
'use client';
import type { UserDto, DashboardStats, UserListResponse } from '@/lib/api/admin/AdminApiClient';
import { AdminUserViewModel, DashboardStatsViewModel, UserListViewModel } from './AdminUserViewModel';
/**
* AdminViewModelPresenter
*
* Presenter layer for transforming API DTOs to ViewModels.
* Runs in client code only ('use client').
* Deterministic, side-effect free transformations.
*/
export class AdminViewModelPresenter {
/**
* Map a single user DTO to a View Model
*/
static mapUser(apiDto: UserDto): AdminUserViewModel {
return new AdminUserViewModel(apiDto);
}
/**
* Map an array of user DTOs to View Models
*/
static mapUsers(apiDtos: UserDto[]): AdminUserViewModel[] {
return apiDtos.map(apiDto => this.mapUser(apiDto));
}
/**
* Map dashboard stats DTO to View Model
*/
static mapDashboardStats(apiDto: DashboardStats): DashboardStatsViewModel {
return new DashboardStatsViewModel(apiDto);
}
/**
* Map user list response to View Model
*/
static mapUserList(viewData: UserListResponse): UserListViewModel {
return new UserListViewModel({
users: viewData.users,
total: viewData.total,
page: viewData.page,
limit: viewData.limit,
totalPages: viewData.totalPages,
});
}
}

View File

@@ -1,105 +0,0 @@
import type { LeagueMembershipsViewModel } from './LeagueMembershipsViewModel';
import type { RaceResultsDetailViewModel } from './RaceResultsDetailViewModel';
import type { RaceWithSOFViewModel } from './RaceWithSOFViewModel';
// TODO fucking violating our architecture, it should be a ViewModel
export interface TransformedRaceResultsData {
raceTrack?: string;
raceScheduledAt?: string;
totalDrivers?: number;
leagueName?: string;
raceSOF: number | null;
results: Array<{
position: number;
driverId: string;
driverName: string;
driverAvatar: string;
country: string;
car: string;
laps: number;
time: string;
fastestLap: string;
points: number;
incidents: number;
isCurrentUser: boolean;
}>;
penalties: Array<{
driverId: string;
driverName: string;
type: 'time_penalty' | 'grid_penalty' | 'points_deduction' | 'disqualification' | 'warning' | 'license_points';
value: number;
reason: string;
notes?: string;
}>;
pointsSystem: Record<string, number>;
fastestLapTime: number;
memberships?: Array<{
driverId: string;
role: string;
}>;
}
export class RaceResultsDataTransformer {
static transform(
resultsData: RaceResultsDetailViewModel | null,
sofData: RaceWithSOFViewModel | null,
currentDriverId: string,
membershipsData?: LeagueMembershipsViewModel
): TransformedRaceResultsData {
if (!resultsData) {
return {
raceSOF: null,
results: [],
penalties: [],
pointsSystem: {},
fastestLapTime: 0,
};
}
// Transform results
const results = resultsData.results.map((result) => ({
position: result.position,
driverId: result.driverId,
driverName: result.driverName,
driverAvatar: result.avatarUrl,
country: 'US', // Default since view model doesn't have car
car: 'Unknown', // Default since view model doesn't have car
laps: 0, // Default since view model doesn't have laps
time: '0:00.00', // Default since view model doesn't have time
fastestLap: result.fastestLap.toString(), // Convert number to string
points: 0, // Default since view model doesn't have points
incidents: result.incidents,
isCurrentUser: result.driverId === currentDriverId,
}));
// Transform penalties
const penalties = resultsData.penalties.map((penalty) => ({
driverId: penalty.driverId,
driverName: resultsData.results.find((r) => r.driverId === penalty.driverId)?.driverName || 'Unknown',
type: penalty.type as 'time_penalty' | 'grid_penalty' | 'points_deduction' | 'disqualification' | 'warning' | 'license_points',
value: penalty.value || 0,
reason: 'Penalty applied', // Default since view model doesn't have reason
notes: undefined, // Default since view model doesn't have notes
}));
// Transform memberships
const memberships = membershipsData?.memberships.map((membership) => ({
driverId: membership.driverId,
role: membership.role || 'member',
}));
return {
raceTrack: resultsData.race?.track,
raceScheduledAt: resultsData.race?.scheduledAt,
totalDrivers: resultsData.stats?.totalDrivers,
leagueName: resultsData.league?.name,
raceSOF: sofData?.strengthOfField || null,
results,
penalties,
pointsSystem: resultsData.pointsSystem || {},
fastestLapTime: resultsData.fastestLapTime || 0,
memberships,
};
}
}

View File

@@ -87,5 +87,3 @@ export * from './UploadMediaViewModel';
export * from './UserProfileViewModel';
export * from './WalletTransactionViewModel';
export * from './WalletViewModel';
export * from './AdminViewModelPresenter';