refactor api modules
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user