view models

This commit is contained in:
2025-12-18 13:56:05 +01:00
parent 91adbb9c83
commit 4f99098b32
20 changed files with 24 additions and 25 deletions

View File

@@ -4,7 +4,7 @@ import { CompleteOnboardingOutputDTO } from '../types/generated/CompleteOnboardi
* Complete onboarding view model * Complete onboarding view model
* UI representation of onboarding completion result * UI representation of onboarding completion result
*/ */
export class CompleteOnboardingViewModel implements CompleteOnboardingOutputDTO { export class CompleteOnboardingViewModel {
success: boolean; success: boolean;
driverId?: string; driverId?: string;

View File

@@ -5,7 +5,7 @@ import { CreateLeagueOutputDTO } from '../types/generated/CreateLeagueOutputDTO'
* *
* Represents the result of creating a league in a UI-ready format. * Represents the result of creating a league in a UI-ready format.
*/ */
export class CreateLeagueViewModel implements CreateLeagueOutputDTO { export class CreateLeagueViewModel {
leagueId: string; leagueId: string;
success: boolean; success: boolean;
@@ -18,4 +18,5 @@ export class CreateLeagueViewModel implements CreateLeagueOutputDTO {
get successMessage(): string { get successMessage(): string {
return this.success ? 'League created successfully!' : 'Failed to create league.'; return this.success ? 'League created successfully!' : 'Failed to create league.';
} }
} }

View File

@@ -1,6 +1,6 @@
import { DriverLeaderboardItemDTO } from '../types/generated/DriverLeaderboardItemDTO'; import { DriverLeaderboardItemDTO } from '../types/generated/DriverLeaderboardItemDTO';
export class DriverLeaderboardItemViewModel implements DriverLeaderboardItemDTO { export class DriverLeaderboardItemViewModel {
id: string; id: string;
name: string; name: string;
rating: number; rating: number;

View File

@@ -1,6 +1,6 @@
import { DriverRegistrationStatusDTO } from '../types/generated/DriverRegistrationStatusDTO'; import { DriverRegistrationStatusDTO } from '../types/generated/DriverRegistrationStatusDTO';
export class DriverRegistrationStatusViewModel implements DriverRegistrationStatusDTO { export class DriverRegistrationStatusViewModel {
isRegistered: boolean; isRegistered: boolean;
raceId: string; raceId: string;
driverId: string; driverId: string;

View File

@@ -5,7 +5,7 @@ interface ImportRaceResultsSummaryDTO {
errors: string[]; errors: string[];
} }
export class ImportRaceResultsSummaryViewModel implements ImportRaceResultsSummaryDTO { export class ImportRaceResultsSummaryViewModel {
raceId: string; raceId: string;
importedCount: number; importedCount: number;
errors: string[]; errors: string[];

View File

@@ -4,13 +4,12 @@ import type { LeagueJoinRequestDTO } from '../types/generated/LeagueJoinRequestD
* League join request view model * League join request view model
* Transform from DTO to ViewModel with UI fields * Transform from DTO to ViewModel with UI fields
*/ */
export class LeagueJoinRequestViewModel implements LeagueJoinRequestDTO { export class LeagueJoinRequestViewModel {
id: string; id: string;
leagueId: string; leagueId: string;
driverId: string; driverId: string;
requestedAt: string; requestedAt: string;
private currentUserId: string;
private isAdmin: boolean; private isAdmin: boolean;
constructor(dto: LeagueJoinRequestDTO, currentUserId: string, isAdmin: boolean) { constructor(dto: LeagueJoinRequestDTO, currentUserId: string, isAdmin: boolean) {
@@ -18,7 +17,6 @@ export class LeagueJoinRequestViewModel implements LeagueJoinRequestDTO {
this.leagueId = dto.leagueId; this.leagueId = dto.leagueId;
this.driverId = dto.driverId; this.driverId = dto.driverId;
this.requestedAt = dto.requestedAt; this.requestedAt = dto.requestedAt;
this.currentUserId = currentUserId;
this.isAdmin = isAdmin; this.isAdmin = isAdmin;
} }

View File

@@ -1,7 +1,7 @@
import { LeagueMemberDTO } from '../types/generated/LeagueMemberDTO'; import { LeagueMemberDTO } from '../types/generated/LeagueMemberDTO';
import { DriverViewModel } from './DriverViewModel'; import { DriverViewModel } from './DriverViewModel';
export class LeagueMemberViewModel implements LeagueMemberDTO { export class LeagueMemberViewModel {
driverId: string; driverId: string;
private currentUserId: string; private currentUserId: string;

View File

@@ -1,6 +1,6 @@
import { LeagueSummaryDTO } from '../types/generated/LeagueSummaryDTO'; import { LeagueSummaryDTO } from '../types/generated/LeagueSummaryDTO';
export class LeagueSummaryViewModel implements LeagueSummaryDTO { export class LeagueSummaryViewModel {
id: string; id: string;
name: string; name: string;

View File

@@ -4,7 +4,7 @@ import { ProtestDTO } from '../types/generated/ProtestDTO';
* Protest view model * Protest view model
* Represents a race protest * Represents a race protest
*/ */
export class ProtestViewModel implements ProtestDTO { export class ProtestViewModel {
id: string; id: string;
raceId: string; raceId: string;
complainantId: string; complainantId: string;

View File

@@ -1,6 +1,6 @@
import { RaceResultDTO } from '../types/generated/RaceResultDTO'; import { RaceResultDTO } from '../types/generated/RaceResultDTO';
export class RaceResultViewModel implements RaceResultDTO { export class RaceResultViewModel {
driverId: string; driverId: string;
driverName: string; driverName: string;
avatarUrl: string; avatarUrl: string;

View File

@@ -1,8 +1,8 @@
import { RaceResultsDetailDTO } from '../types/generated/RaceResultsDetailDTO';
import { RaceResultDTO } from '../types/generated/RaceResultDTO'; import { RaceResultDTO } from '../types/generated/RaceResultDTO';
import { RaceResultsDetailDTO } from '../types/generated/RaceResultsDetailDTO';
import { RaceResultViewModel } from './RaceResultViewModel'; import { RaceResultViewModel } from './RaceResultViewModel';
export class RaceResultsDetailViewModel implements RaceResultsDetailDTO { export class RaceResultsDetailViewModel {
raceId: string; raceId: string;
track: string; track: string;

View File

@@ -1,6 +1,6 @@
import { RaceWithSOFDTO } from '../types/generated/RaceWithSOFDTO'; import { RaceWithSOFDTO } from '../types/generated/RaceWithSOFDTO';
export class RaceWithSOFViewModel implements RaceWithSOFDTO { export class RaceWithSOFViewModel {
id: string; id: string;
track: string; track: string;

View File

@@ -5,7 +5,7 @@ import { RemoveLeagueMemberOutputDTO } from '../types/generated/RemoveLeagueMemb
* *
* Represents the result of removing a member from a league in a UI-ready format. * Represents the result of removing a member from a league in a UI-ready format.
*/ */
export class RemoveMemberViewModel implements RemoveLeagueMemberOutputDTO { export class RemoveMemberViewModel {
success: boolean; success: boolean;
constructor(dto: RemoveLeagueMemberOutputDTO) { constructor(dto: RemoveLeagueMemberOutputDTO) {

View File

@@ -1,6 +1,6 @@
import { AuthenticatedUserDTO } from '../types/generated/AuthenticatedUserDTO'; import { AuthenticatedUserDTO } from '../types/generated/AuthenticatedUserDTO';
export class SessionViewModel implements AuthenticatedUserDTO { export class SessionViewModel {
userId: string; userId: string;
email: string; email: string;
displayName: string; displayName: string;

View File

@@ -5,7 +5,7 @@ import type { SponsorDashboardDTO } from '../types/generated/SponsorDashboardDTO
* *
* View model for sponsor dashboard data with UI-specific transformations. * View model for sponsor dashboard data with UI-specific transformations.
*/ */
export class SponsorDashboardViewModel implements SponsorDashboardDTO { export class SponsorDashboardViewModel {
sponsorId: string; sponsorId: string;
sponsorName: string; sponsorName: string;

View File

@@ -6,7 +6,7 @@ import { SponsorshipDetailViewModel } from './SponsorshipDetailViewModel';
* *
* View model for sponsor sponsorships data with UI-specific transformations. * View model for sponsor sponsorships data with UI-specific transformations.
*/ */
export class SponsorSponsorshipsViewModel implements SponsorSponsorshipsDTO { export class SponsorSponsorshipsViewModel {
sponsorId: string; sponsorId: string;
sponsorName: string; sponsorName: string;

View File

@@ -1,6 +1,6 @@
import { SponsorshipDetailDTO } from '../types/generated/SponsorshipDetailDTO'; import { SponsorshipDetailDTO } from '../types/generated/SponsorshipDetailDTO';
export class SponsorshipDetailViewModel implements SponsorshipDetailDTO { export class SponsorshipDetailViewModel {
id: string; id: string;
leagueId: string; leagueId: string;
leagueName: string; leagueName: string;

View File

@@ -1,6 +1,6 @@
import { LeagueStandingDTO } from '../types/generated/LeagueStandingDTO'; import { LeagueStandingDTO } from '../types/generated/LeagueStandingDTO';
export class StandingEntryViewModel implements LeagueStandingDTO { export class StandingEntryViewModel {
driverId: string; driverId: string;
position: number; position: number;
points: number; points: number;

View File

@@ -8,7 +8,7 @@ export type FullTransactionDto = TransactionDto & {
type: 'deposit' | 'withdrawal'; type: 'deposit' | 'withdrawal';
}; };
export class WalletTransactionViewModel implements FullTransactionDto { export class WalletTransactionViewModel {
id: string; id: string;
walletId: string; walletId: string;
amount: number; amount: number;

View File

@@ -1,7 +1,7 @@
import { WalletDto } from '../types/generated/WalletDto'; import { WalletDto } from '../types/generated/WalletDto';
import { WalletTransactionViewModel, FullTransactionDto } from './WalletTransactionViewModel'; import { FullTransactionDto, WalletTransactionViewModel } from './WalletTransactionViewModel';
export class WalletViewModel implements WalletDto { export class WalletViewModel {
id: string; id: string;
leagueId: string; leagueId: string;
balance: number; balance: number;