resolve manual DTOs
This commit is contained in:
226
apps/api/src/domain/driver/dtos/GetDriverProfileOutputDTO.ts
Normal file
226
apps/api/src/domain/driver/dtos/GetDriverProfileOutputDTO.ts
Normal file
@@ -0,0 +1,226 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
export class DriverProfileDriverSummaryDTO {
|
||||
@ApiProperty()
|
||||
id: string;
|
||||
|
||||
@ApiProperty()
|
||||
name: string;
|
||||
|
||||
@ApiProperty()
|
||||
country: string;
|
||||
|
||||
@ApiProperty()
|
||||
avatarUrl: string;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
iracingId: string | null;
|
||||
|
||||
@ApiProperty()
|
||||
joinedAt: string;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
rating: number | null;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
globalRank: number | null;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
consistency: number | null;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
bio: string | null;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
totalDrivers: number | null;
|
||||
}
|
||||
|
||||
export class DriverProfileStatsDTO {
|
||||
@ApiProperty()
|
||||
totalRaces: number;
|
||||
|
||||
@ApiProperty()
|
||||
wins: number;
|
||||
|
||||
@ApiProperty()
|
||||
podiums: number;
|
||||
|
||||
@ApiProperty()
|
||||
dnfs: number;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
avgFinish: number | null;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
bestFinish: number | null;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
worstFinish: number | null;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
finishRate: number | null;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
winRate: number | null;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
podiumRate: number | null;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
percentile: number | null;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
rating: number | null;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
consistency: number | null;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
overallRank: number | null;
|
||||
}
|
||||
|
||||
export class DriverProfileFinishDistributionDTO {
|
||||
@ApiProperty()
|
||||
totalRaces: number;
|
||||
|
||||
@ApiProperty()
|
||||
wins: number;
|
||||
|
||||
@ApiProperty()
|
||||
podiums: number;
|
||||
|
||||
@ApiProperty()
|
||||
topTen: number;
|
||||
|
||||
@ApiProperty()
|
||||
dnfs: number;
|
||||
|
||||
@ApiProperty()
|
||||
other: number;
|
||||
}
|
||||
|
||||
export class DriverProfileTeamMembershipDTO {
|
||||
@ApiProperty()
|
||||
teamId: string;
|
||||
|
||||
@ApiProperty()
|
||||
teamName: string;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
teamTag: string | null;
|
||||
|
||||
@ApiProperty()
|
||||
role: string;
|
||||
|
||||
@ApiProperty()
|
||||
joinedAt: string;
|
||||
|
||||
@ApiProperty()
|
||||
isCurrent: boolean;
|
||||
}
|
||||
|
||||
export class DriverProfileSocialFriendSummaryDTO {
|
||||
@ApiProperty()
|
||||
id: string;
|
||||
|
||||
@ApiProperty()
|
||||
name: string;
|
||||
|
||||
@ApiProperty()
|
||||
country: string;
|
||||
|
||||
@ApiProperty()
|
||||
avatarUrl: string;
|
||||
}
|
||||
|
||||
export class DriverProfileSocialSummaryDTO {
|
||||
@ApiProperty()
|
||||
friendsCount: number;
|
||||
|
||||
@ApiProperty({ type: [DriverProfileSocialFriendSummaryDTO] })
|
||||
friends: DriverProfileSocialFriendSummaryDTO[];
|
||||
}
|
||||
|
||||
export type DriverProfileSocialPlatform = 'twitter' | 'youtube' | 'twitch' | 'discord';
|
||||
|
||||
export type DriverProfileAchievementRarity = 'common' | 'rare' | 'epic' | 'legendary';
|
||||
|
||||
export class DriverProfileAchievementDTO {
|
||||
@ApiProperty()
|
||||
id: string;
|
||||
|
||||
@ApiProperty()
|
||||
title: string;
|
||||
|
||||
@ApiProperty()
|
||||
description: string;
|
||||
|
||||
@ApiProperty({ enum: ['trophy', 'medal', 'star', 'crown', 'target', 'zap'] })
|
||||
icon: 'trophy' | 'medal' | 'star' | 'crown' | 'target' | 'zap';
|
||||
|
||||
@ApiProperty({ enum: DriverProfileAchievementRarity })
|
||||
rarity: DriverProfileAchievementRarity;
|
||||
|
||||
@ApiProperty()
|
||||
earnedAt: string;
|
||||
}
|
||||
|
||||
export class DriverProfileSocialHandleDTO {
|
||||
@ApiProperty({ enum: DriverProfileSocialPlatform })
|
||||
platform: DriverProfileSocialPlatform;
|
||||
|
||||
@ApiProperty()
|
||||
handle: string;
|
||||
|
||||
@ApiProperty()
|
||||
url: string;
|
||||
}
|
||||
|
||||
export class DriverProfileExtendedProfileDTO {
|
||||
@ApiProperty({ type: [DriverProfileSocialHandleDTO] })
|
||||
socialHandles: DriverProfileSocialHandleDTO[];
|
||||
|
||||
@ApiProperty({ type: [DriverProfileAchievementDTO] })
|
||||
achievements: DriverProfileAchievementDTO[];
|
||||
|
||||
@ApiProperty()
|
||||
racingStyle: string;
|
||||
|
||||
@ApiProperty()
|
||||
favoriteTrack: string;
|
||||
|
||||
@ApiProperty()
|
||||
favoriteCar: string;
|
||||
|
||||
@ApiProperty()
|
||||
timezone: string;
|
||||
|
||||
@ApiProperty()
|
||||
availableHours: string;
|
||||
|
||||
@ApiProperty()
|
||||
lookingForTeam: boolean;
|
||||
|
||||
@ApiProperty()
|
||||
openToRequests: boolean;
|
||||
}
|
||||
|
||||
export class GetDriverProfileOutputDTO {
|
||||
@ApiProperty({ type: DriverProfileDriverSummaryDTO, nullable: true })
|
||||
currentDriver: DriverProfileDriverSummaryDTO | null;
|
||||
|
||||
@ApiProperty({ type: DriverProfileStatsDTO, nullable: true })
|
||||
stats: DriverProfileStatsDTO | null;
|
||||
|
||||
@ApiProperty({ type: DriverProfileFinishDistributionDTO, nullable: true })
|
||||
finishDistribution: DriverProfileFinishDistributionDTO | null;
|
||||
|
||||
@ApiProperty({ type: [DriverProfileTeamMembershipDTO] })
|
||||
teamMemberships: DriverProfileTeamMembershipDTO[];
|
||||
|
||||
@ApiProperty({ type: DriverProfileSocialSummaryDTO })
|
||||
socialSummary: DriverProfileSocialSummaryDTO;
|
||||
|
||||
@ApiProperty({ type: DriverProfileExtendedProfileDTO, nullable: true })
|
||||
extendedProfile: DriverProfileExtendedProfileDTO | null;
|
||||
}
|
||||
Reference in New Issue
Block a user