fix(mining-admin-service): 修复LoginDto验证装饰器缺失

添加 @IsString() 和 @IsNotEmpty() 装饰器到 LoginDto,
修复 ValidationPipe forbidNonWhitelisted 导致的400错误

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-01-11 00:54:37 -08:00
parent fe7dda396f
commit 86f2c85f8d
1 changed files with 13 additions and 2 deletions

View File

@ -1,9 +1,20 @@
import { Controller, Post, Body, Req, HttpCode, HttpStatus } from '@nestjs/common'; import { Controller, Post, Body, Req, HttpCode, HttpStatus } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger'; import { ApiTags, ApiOperation, ApiBearerAuth, ApiProperty } from '@nestjs/swagger';
import { IsString, IsNotEmpty } from 'class-validator';
import { AuthService } from '../../application/services/auth.service'; import { AuthService } from '../../application/services/auth.service';
import { Public } from '../../shared/guards/admin-auth.guard'; import { Public } from '../../shared/guards/admin-auth.guard';
class LoginDto { username: string; password: string; } class LoginDto {
@ApiProperty({ description: '用户名' })
@IsString()
@IsNotEmpty()
username: string;
@ApiProperty({ description: '密码' })
@IsString()
@IsNotEmpty()
password: string;
}
@ApiTags('Auth') @ApiTags('Auth')
@Controller('auth') @Controller('auth')