From 8148f7a52acb8537619c2b3e78aebf1d12297f1f Mon Sep 17 00:00:00 2001 From: hailin Date: Sun, 4 Jan 2026 04:11:05 -0800 Subject: [PATCH] fix(leaderboard-service): add @IsIn validator to UpdateLeaderboardSwitchDto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../leaderboard-service/src/api/dto/leaderboard-config.dto.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/services/leaderboard-service/src/api/dto/leaderboard-config.dto.ts b/backend/services/leaderboard-service/src/api/dto/leaderboard-config.dto.ts index 096cd0f0..3f43456f 100644 --- a/backend/services/leaderboard-service/src/api/dto/leaderboard-config.dto.ts +++ b/backend/services/leaderboard-service/src/api/dto/leaderboard-config.dto.ts @@ -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 })