57 lines
1.3 KiB
TypeScript
57 lines
1.3 KiB
TypeScript
import { IsInt, Min, Max, IsOptional } from 'class-validator';
|
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
|
|
export class GetLeaderboardDto {
|
|
@ApiPropertyOptional({ description: '每页数量', default: 100 })
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(1)
|
|
@Max(100)
|
|
limit?: number = 100;
|
|
|
|
@ApiPropertyOptional({ description: '偏移量', default: 0 })
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(0)
|
|
offset?: number = 0;
|
|
}
|
|
|
|
export class LeaderboardEntryResponseDto {
|
|
@ApiProperty({ description: '排名' })
|
|
rank: number;
|
|
|
|
@ApiProperty({ description: '用户ID' })
|
|
userId: string;
|
|
|
|
@ApiProperty({ description: '龙虎榜分值' })
|
|
score: number;
|
|
|
|
@ApiProperty({ description: '团队总认种量' })
|
|
totalTeamCount: number;
|
|
|
|
@ApiProperty({ description: '直推人数' })
|
|
directReferralCount: number;
|
|
}
|
|
|
|
export class LeaderboardResponseDto {
|
|
@ApiProperty({ type: [LeaderboardEntryResponseDto] })
|
|
entries: LeaderboardEntryResponseDto[];
|
|
|
|
@ApiProperty({ description: '总数' })
|
|
total: number;
|
|
|
|
@ApiProperty({ description: '是否有更多' })
|
|
hasMore: boolean;
|
|
}
|
|
|
|
export class UserRankResponseDto {
|
|
@ApiProperty({ description: '用户ID' })
|
|
userId: string;
|
|
|
|
@ApiProperty({ description: '排名', nullable: true })
|
|
rank: number | null;
|
|
|
|
@ApiProperty({ description: '龙虎榜分值' })
|
|
score: number;
|
|
}
|