refactor api modules
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsNotEmpty, IsOptional } from 'class-validator';
|
||||
import { IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
||||
|
||||
export class CreateTeamInputDTO {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
name: string;
|
||||
name!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
tag: string;
|
||||
tag!: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
|
||||
@@ -2,8 +2,8 @@ import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
export class CreateTeamOutputDTO {
|
||||
@ApiProperty()
|
||||
id: string;
|
||||
id!: string;
|
||||
|
||||
@ApiProperty()
|
||||
success: boolean;
|
||||
success!: boolean;
|
||||
}
|
||||
@@ -2,22 +2,22 @@ import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
class TeamListItemDTO {
|
||||
@ApiProperty()
|
||||
id: string;
|
||||
id!: string;
|
||||
|
||||
@ApiProperty()
|
||||
name: string;
|
||||
name!: string;
|
||||
|
||||
@ApiProperty()
|
||||
tag: string;
|
||||
tag!: string;
|
||||
|
||||
@ApiProperty()
|
||||
description: string;
|
||||
description!: string;
|
||||
|
||||
@ApiProperty()
|
||||
memberCount: number;
|
||||
memberCount!: number;
|
||||
|
||||
@ApiProperty({ type: [String] })
|
||||
leagues: string[];
|
||||
leagues!: string[];
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
specialization?: 'endurance' | 'sprint' | 'mixed';
|
||||
@@ -31,8 +31,8 @@ class TeamListItemDTO {
|
||||
|
||||
export class GetAllTeamsOutputDTO {
|
||||
@ApiProperty({ type: [TeamListItemDTO] })
|
||||
teams: TeamListItemDTO[];
|
||||
teams!: TeamListItemDTO[];
|
||||
|
||||
@ApiProperty()
|
||||
totalCount: number;
|
||||
totalCount!: number;
|
||||
}
|
||||
@@ -2,22 +2,22 @@ import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
class TeamDTO {
|
||||
@ApiProperty()
|
||||
id: string;
|
||||
id!: string;
|
||||
|
||||
@ApiProperty()
|
||||
name: string;
|
||||
name!: string;
|
||||
|
||||
@ApiProperty()
|
||||
tag: string;
|
||||
tag!: string;
|
||||
|
||||
@ApiProperty()
|
||||
description: string;
|
||||
description!: string;
|
||||
|
||||
@ApiProperty()
|
||||
ownerId: string;
|
||||
ownerId!: string;
|
||||
|
||||
@ApiProperty({ type: [String] })
|
||||
leagues: string[];
|
||||
leagues!: string[];
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
createdAt?: string;
|
||||
@@ -34,25 +34,25 @@ class TeamDTO {
|
||||
|
||||
class MembershipDTO {
|
||||
@ApiProperty()
|
||||
role: 'owner' | 'manager' | 'member';
|
||||
role!: 'owner' | 'manager' | 'member';
|
||||
|
||||
@ApiProperty()
|
||||
joinedAt: string;
|
||||
joinedAt!: string;
|
||||
|
||||
@ApiProperty()
|
||||
isActive: boolean;
|
||||
isActive!: boolean;
|
||||
}
|
||||
|
||||
export class GetDriverTeamOutputDTO {
|
||||
@ApiProperty({ type: TeamDTO })
|
||||
team: TeamDTO;
|
||||
team!: TeamDTO;
|
||||
|
||||
@ApiProperty({ type: MembershipDTO })
|
||||
membership: MembershipDTO;
|
||||
membership!: MembershipDTO;
|
||||
|
||||
@ApiProperty()
|
||||
isOwner: boolean;
|
||||
isOwner!: boolean;
|
||||
|
||||
@ApiProperty()
|
||||
canManage: boolean;
|
||||
canManage!: boolean;
|
||||
}
|
||||
@@ -2,22 +2,22 @@ import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
class TeamDTO {
|
||||
@ApiProperty()
|
||||
id: string;
|
||||
id!: string;
|
||||
|
||||
@ApiProperty()
|
||||
name: string;
|
||||
name!: string;
|
||||
|
||||
@ApiProperty()
|
||||
tag: string;
|
||||
tag!: string;
|
||||
|
||||
@ApiProperty()
|
||||
description: string;
|
||||
description!: string;
|
||||
|
||||
@ApiProperty()
|
||||
ownerId: string;
|
||||
ownerId!: string;
|
||||
|
||||
@ApiProperty({ type: [String] })
|
||||
leagues: string[];
|
||||
leagues!: string[];
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
createdAt?: string;
|
||||
@@ -34,22 +34,22 @@ class TeamDTO {
|
||||
|
||||
class MembershipDTO {
|
||||
@ApiProperty()
|
||||
role: 'owner' | 'manager' | 'member';
|
||||
role!: 'owner' | 'manager' | 'member';
|
||||
|
||||
@ApiProperty()
|
||||
joinedAt: string;
|
||||
joinedAt!: string;
|
||||
|
||||
@ApiProperty()
|
||||
isActive: boolean;
|
||||
isActive!: boolean;
|
||||
}
|
||||
|
||||
export class GetTeamDetailsOutputDTO {
|
||||
@ApiProperty({ type: TeamDTO })
|
||||
team: TeamDTO;
|
||||
team!: TeamDTO;
|
||||
|
||||
@ApiProperty({ type: MembershipDTO, nullable: true })
|
||||
membership: MembershipDTO | null;
|
||||
membership!: MembershipDTO | null;
|
||||
|
||||
@ApiProperty()
|
||||
canManage: boolean;
|
||||
canManage!: boolean;
|
||||
}
|
||||
@@ -2,34 +2,34 @@ import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
class TeamJoinRequestDTO {
|
||||
@ApiProperty()
|
||||
requestId: string;
|
||||
requestId!: string;
|
||||
|
||||
@ApiProperty()
|
||||
driverId: string;
|
||||
driverId!: string;
|
||||
|
||||
@ApiProperty()
|
||||
driverName: string;
|
||||
driverName!: string;
|
||||
|
||||
@ApiProperty()
|
||||
teamId: string;
|
||||
teamId!: string;
|
||||
|
||||
@ApiProperty()
|
||||
status: 'pending' | 'approved' | 'rejected';
|
||||
status!: 'pending' | 'approved' | 'rejected';
|
||||
|
||||
@ApiProperty()
|
||||
requestedAt: string;
|
||||
requestedAt!: string;
|
||||
|
||||
@ApiProperty()
|
||||
avatarUrl: string;
|
||||
avatarUrl!: string;
|
||||
}
|
||||
|
||||
export class GetTeamJoinRequestsOutputDTO {
|
||||
@ApiProperty({ type: [TeamJoinRequestDTO] })
|
||||
requests: TeamJoinRequestDTO[];
|
||||
requests!: TeamJoinRequestDTO[];
|
||||
|
||||
@ApiProperty()
|
||||
pendingCount: number;
|
||||
pendingCount!: number;
|
||||
|
||||
@ApiProperty()
|
||||
totalCount: number;
|
||||
totalCount!: number;
|
||||
}
|
||||
@@ -2,37 +2,37 @@ import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
class TeamMemberDTO {
|
||||
@ApiProperty()
|
||||
driverId: string;
|
||||
driverId!: string;
|
||||
|
||||
@ApiProperty()
|
||||
driverName: string;
|
||||
driverName!: string;
|
||||
|
||||
@ApiProperty()
|
||||
role: 'owner' | 'manager' | 'member';
|
||||
role!: 'owner' | 'manager' | 'member';
|
||||
|
||||
@ApiProperty()
|
||||
joinedAt: string;
|
||||
joinedAt!: string;
|
||||
|
||||
@ApiProperty()
|
||||
isActive: boolean;
|
||||
isActive!: boolean;
|
||||
|
||||
@ApiProperty()
|
||||
avatarUrl: string;
|
||||
avatarUrl!: string;
|
||||
}
|
||||
|
||||
export class GetTeamMembersOutputDTO {
|
||||
@ApiProperty({ type: [TeamMemberDTO] })
|
||||
members: TeamMemberDTO[];
|
||||
members!: TeamMemberDTO[];
|
||||
|
||||
@ApiProperty()
|
||||
totalCount: number;
|
||||
totalCount!: number;
|
||||
|
||||
@ApiProperty()
|
||||
ownerCount: number;
|
||||
ownerCount!: number;
|
||||
|
||||
@ApiProperty()
|
||||
managerCount: number;
|
||||
managerCount!: number;
|
||||
|
||||
@ApiProperty()
|
||||
memberCount: number;
|
||||
memberCount!: number;
|
||||
}
|
||||
@@ -2,11 +2,11 @@ import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
export class GetTeamMembershipOutputDTO {
|
||||
@ApiProperty()
|
||||
role: 'owner' | 'manager' | 'member';
|
||||
role!: 'owner' | 'manager' | 'member';
|
||||
|
||||
@ApiProperty()
|
||||
joinedAt: string;
|
||||
joinedAt!: string;
|
||||
|
||||
@ApiProperty()
|
||||
isActive: boolean;
|
||||
isActive!: boolean;
|
||||
}
|
||||
@@ -4,31 +4,31 @@ export type SkillLevel = 'beginner' | 'intermediate' | 'advanced' | 'pro';
|
||||
|
||||
class TeamLeaderboardItemDTO {
|
||||
@ApiProperty()
|
||||
id: string;
|
||||
id!: string;
|
||||
|
||||
@ApiProperty()
|
||||
name: string;
|
||||
name!: string;
|
||||
|
||||
@ApiProperty()
|
||||
memberCount: number;
|
||||
memberCount!: number;
|
||||
|
||||
@ApiProperty({ nullable: true })
|
||||
rating: number | null;
|
||||
rating!: number | null;
|
||||
|
||||
@ApiProperty()
|
||||
totalWins: number;
|
||||
totalWins!: number;
|
||||
|
||||
@ApiProperty()
|
||||
totalRaces: number;
|
||||
totalRaces!: number;
|
||||
|
||||
@ApiProperty({ enum: ['beginner', 'intermediate', 'advanced', 'pro'] })
|
||||
performanceLevel: SkillLevel;
|
||||
performanceLevel!: SkillLevel;
|
||||
|
||||
@ApiProperty()
|
||||
isRecruiting: boolean;
|
||||
isRecruiting!: boolean;
|
||||
|
||||
@ApiProperty()
|
||||
createdAt: string;
|
||||
createdAt!: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
description?: string;
|
||||
@@ -45,14 +45,14 @@ class TeamLeaderboardItemDTO {
|
||||
|
||||
export class GetTeamsLeaderboardOutputDTO {
|
||||
@ApiProperty({ type: [TeamLeaderboardItemDTO] })
|
||||
teams: TeamLeaderboardItemDTO[];
|
||||
teams!: TeamLeaderboardItemDTO[];
|
||||
|
||||
@ApiProperty()
|
||||
recruitingCount: number;
|
||||
recruitingCount!: number;
|
||||
|
||||
@ApiProperty({ type: 'object', additionalProperties: { type: 'array', items: { $ref: '#/components/schemas/TeamLeaderboardItemDTO' } } })
|
||||
groupsBySkillLevel: Record<SkillLevel, TeamLeaderboardItemDTO[]>;
|
||||
groupsBySkillLevel!: Record<SkillLevel, TeamLeaderboardItemDTO[]>;
|
||||
|
||||
@ApiProperty({ type: [TeamLeaderboardItemDTO] })
|
||||
topTeams: TeamLeaderboardItemDTO[];
|
||||
topTeams!: TeamLeaderboardItemDTO[];
|
||||
}
|
||||
@@ -3,22 +3,22 @@ import { IsString, IsNotEmpty, IsBoolean, IsOptional } from 'class-validator';
|
||||
|
||||
export class TeamListItemViewModel {
|
||||
@ApiProperty()
|
||||
id: string;
|
||||
id!: string;
|
||||
|
||||
@ApiProperty()
|
||||
name: string;
|
||||
name!: string;
|
||||
|
||||
@ApiProperty()
|
||||
tag: string;
|
||||
tag!: string;
|
||||
|
||||
@ApiProperty()
|
||||
description: string;
|
||||
description!: string;
|
||||
|
||||
@ApiProperty()
|
||||
memberCount: number;
|
||||
memberCount!: number;
|
||||
|
||||
@ApiProperty({ type: [String] })
|
||||
leagues: string[];
|
||||
leagues!: string[];
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
specialization?: 'endurance' | 'sprint' | 'mixed';
|
||||
@@ -32,30 +32,30 @@ export class TeamListItemViewModel {
|
||||
|
||||
export class AllTeamsViewModel {
|
||||
@ApiProperty({ type: [TeamListItemViewModel] })
|
||||
teams: TeamListItemViewModel[];
|
||||
teams!: TeamListItemViewModel[];
|
||||
|
||||
@ApiProperty()
|
||||
totalCount: number;
|
||||
totalCount!: number;
|
||||
}
|
||||
|
||||
export class TeamViewModel {
|
||||
@ApiProperty()
|
||||
id: string;
|
||||
id!: string;
|
||||
|
||||
@ApiProperty()
|
||||
name: string;
|
||||
name!: string;
|
||||
|
||||
@ApiProperty()
|
||||
tag: string;
|
||||
tag!: string;
|
||||
|
||||
@ApiProperty()
|
||||
description: string;
|
||||
description!: string;
|
||||
|
||||
@ApiProperty()
|
||||
ownerId: string;
|
||||
ownerId!: string;
|
||||
|
||||
@ApiProperty({ type: [String] })
|
||||
leagues: string[];
|
||||
leagues!: string[];
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
createdAt?: string;
|
||||
@@ -85,131 +85,131 @@ export enum MembershipStatus {
|
||||
|
||||
export class MembershipViewModel {
|
||||
@ApiProperty()
|
||||
role: 'owner' | 'manager' | 'member';
|
||||
role!: 'owner' | 'manager' | 'member';
|
||||
|
||||
@ApiProperty()
|
||||
joinedAt: string;
|
||||
joinedAt!: string;
|
||||
|
||||
@ApiProperty()
|
||||
isActive: boolean;
|
||||
isActive!: boolean;
|
||||
}
|
||||
|
||||
export class DriverTeamViewModel {
|
||||
@ApiProperty({ type: TeamViewModel })
|
||||
team: TeamViewModel;
|
||||
team!: TeamViewModel;
|
||||
|
||||
@ApiProperty({ type: MembershipViewModel })
|
||||
membership: MembershipViewModel;
|
||||
membership!: MembershipViewModel;
|
||||
|
||||
@ApiProperty()
|
||||
isOwner: boolean;
|
||||
isOwner!: boolean;
|
||||
|
||||
@ApiProperty()
|
||||
canManage: boolean;
|
||||
canManage!: boolean;
|
||||
}
|
||||
|
||||
export class GetDriverTeamQuery {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
teamId: string;
|
||||
teamId!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
driverId: string;
|
||||
driverId!: string;
|
||||
}
|
||||
|
||||
export class TeamDetailsViewModel {
|
||||
@ApiProperty({ type: TeamViewModel })
|
||||
team: TeamViewModel;
|
||||
team!: TeamViewModel;
|
||||
|
||||
@ApiProperty({ type: MembershipViewModel, nullable: true })
|
||||
membership: MembershipViewModel | null;
|
||||
membership!: MembershipViewModel | null;
|
||||
|
||||
@ApiProperty()
|
||||
canManage: boolean;
|
||||
canManage!: boolean;
|
||||
}
|
||||
|
||||
export class TeamMemberViewModel {
|
||||
@ApiProperty()
|
||||
driverId: string;
|
||||
driverId!: string;
|
||||
|
||||
@ApiProperty()
|
||||
driverName: string;
|
||||
driverName!: string;
|
||||
|
||||
@ApiProperty()
|
||||
role: 'owner' | 'manager' | 'member';
|
||||
role!: 'owner' | 'manager' | 'member';
|
||||
|
||||
@ApiProperty()
|
||||
joinedAt: string;
|
||||
joinedAt!: string;
|
||||
|
||||
@ApiProperty()
|
||||
isActive: boolean;
|
||||
isActive!: boolean;
|
||||
|
||||
@ApiProperty()
|
||||
avatarUrl: string;
|
||||
avatarUrl!: string;
|
||||
}
|
||||
|
||||
export class TeamMembersViewModel {
|
||||
@ApiProperty({ type: [TeamMemberViewModel] })
|
||||
members: TeamMemberViewModel[];
|
||||
members!: TeamMemberViewModel[];
|
||||
|
||||
@ApiProperty()
|
||||
totalCount: number;
|
||||
totalCount!: number;
|
||||
|
||||
@ApiProperty()
|
||||
ownerCount: number;
|
||||
ownerCount!: number;
|
||||
|
||||
@ApiProperty()
|
||||
managerCount: number;
|
||||
managerCount!: number;
|
||||
|
||||
@ApiProperty()
|
||||
memberCount: number;
|
||||
memberCount!: number;
|
||||
}
|
||||
|
||||
export class TeamJoinRequestViewModel {
|
||||
@ApiProperty()
|
||||
requestId: string;
|
||||
requestId!: string;
|
||||
|
||||
@ApiProperty()
|
||||
driverId: string;
|
||||
driverId!: string;
|
||||
|
||||
@ApiProperty()
|
||||
driverName: string;
|
||||
driverName!: string;
|
||||
|
||||
@ApiProperty()
|
||||
teamId: string;
|
||||
teamId!: string;
|
||||
|
||||
@ApiProperty()
|
||||
status: 'pending' | 'approved' | 'rejected';
|
||||
status!: 'pending' | 'approved' | 'rejected';
|
||||
|
||||
@ApiProperty()
|
||||
requestedAt: string;
|
||||
requestedAt!: string;
|
||||
|
||||
@ApiProperty()
|
||||
avatarUrl: string;
|
||||
avatarUrl!: string;
|
||||
}
|
||||
|
||||
export class TeamJoinRequestsViewModel {
|
||||
@ApiProperty({ type: [TeamJoinRequestViewModel] })
|
||||
requests: TeamJoinRequestViewModel[];
|
||||
requests!: TeamJoinRequestViewModel[];
|
||||
|
||||
@ApiProperty()
|
||||
pendingCount: number;
|
||||
pendingCount!: number;
|
||||
|
||||
@ApiProperty()
|
||||
totalCount: number;
|
||||
totalCount!: number;
|
||||
}
|
||||
|
||||
export class CreateTeamInput {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
name: string;
|
||||
name!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
tag: string;
|
||||
tag!: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@@ -218,17 +218,17 @@ export class CreateTeamInput {
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
ownerId: string;
|
||||
ownerId!: string;
|
||||
}
|
||||
|
||||
export class CreateTeamOutput {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
teamId: string;
|
||||
teamId!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
success: boolean;
|
||||
success!: boolean;
|
||||
}
|
||||
|
||||
export class UpdateTeamInput {
|
||||
@@ -254,19 +254,19 @@ export class UpdateTeamInput {
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
updatedBy: string;
|
||||
updatedBy!: string;
|
||||
}
|
||||
|
||||
export class UpdateTeamOutput {
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
success: boolean;
|
||||
success!: boolean;
|
||||
}
|
||||
|
||||
export class ApproveTeamJoinRequestInput {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
requestId: string;
|
||||
requestId!: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@@ -277,13 +277,13 @@ export class ApproveTeamJoinRequestInput {
|
||||
export class ApproveTeamJoinRequestOutput {
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
success: boolean;
|
||||
success!: boolean;
|
||||
}
|
||||
|
||||
export class RejectTeamJoinRequestInput {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
requestId: string;
|
||||
requestId!: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@@ -294,5 +294,5 @@ export class RejectTeamJoinRequestInput {
|
||||
export class RejectTeamJoinRequestOutput {
|
||||
@ApiProperty()
|
||||
@IsBoolean()
|
||||
success: boolean;
|
||||
success!: boolean;
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@ import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
export class UpdateTeamOutputDTO {
|
||||
@ApiProperty()
|
||||
success: boolean;
|
||||
success!: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user