fix(leaderboard-service): add @IsIn validator to UpdateLeaderboardSwitchDto

The 'type' field was missing validation decorator, causing 400 Bad Request
when ValidationPipe with forbidNonWhitelisted was enabled.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-04 04:11:05 -08:00
parent aa58b9e745
commit 8148f7a52a
1 changed files with 2 additions and 1 deletions

View File

@ -1,5 +1,5 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsBoolean, IsInt, IsOptional, Min, Max } from 'class-validator';
import { IsBoolean, IsInt, IsOptional, IsIn, Min, Max } from 'class-validator';
import { Type } from 'class-transformer';
/**
@ -57,6 +57,7 @@ export class UpdateLeaderboardSwitchDto {
description: '榜单类型',
example: 'daily',
})
@IsIn(['daily', 'weekly', 'monthly'])
type: 'daily' | 'weekly' | 'monthly';
@ApiProperty({ description: '是否启用', example: true })