fix(auth-service): 修复支付密码DTO缺少class-validator装饰器导致请求被ValidationPipe拒绝
根因:ValidationPipe配置了whitelist+forbidNonWhitelisted,但DTO类的属性 没有任何class-validator装饰器,导致所有请求体属性被当作非白名单属性直接 返回Bad Request,请求根本未到达业务逻辑层。 修复:为SetTradePasswordDto、ChangeTradePasswordDto、VerifyTradePasswordDto 添加@IsString()和@IsNotEmpty()装饰器。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
16da1d20f0
commit
74f061cfeb
|
|
@ -7,22 +7,35 @@ import {
|
||||||
HttpStatus,
|
HttpStatus,
|
||||||
UseGuards,
|
UseGuards,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
|
import { IsString, IsNotEmpty } from 'class-validator';
|
||||||
import { ThrottlerGuard } from '@nestjs/throttler';
|
import { ThrottlerGuard } from '@nestjs/throttler';
|
||||||
import { TradePasswordService } from '@/application/services/trade-password.service';
|
import { TradePasswordService } from '@/application/services/trade-password.service';
|
||||||
import { JwtAuthGuard } from '@/shared/guards/jwt-auth.guard';
|
import { JwtAuthGuard } from '@/shared/guards/jwt-auth.guard';
|
||||||
import { CurrentUser } from '@/shared/decorators/current-user.decorator';
|
import { CurrentUser } from '@/shared/decorators/current-user.decorator';
|
||||||
|
|
||||||
class SetTradePasswordDto {
|
class SetTradePasswordDto {
|
||||||
|
@IsString()
|
||||||
|
@IsNotEmpty()
|
||||||
loginPassword: string;
|
loginPassword: string;
|
||||||
|
|
||||||
|
@IsString()
|
||||||
|
@IsNotEmpty()
|
||||||
tradePassword: string;
|
tradePassword: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ChangeTradePasswordDto {
|
class ChangeTradePasswordDto {
|
||||||
|
@IsString()
|
||||||
|
@IsNotEmpty()
|
||||||
oldTradePassword: string;
|
oldTradePassword: string;
|
||||||
|
|
||||||
|
@IsString()
|
||||||
|
@IsNotEmpty()
|
||||||
newTradePassword: string;
|
newTradePassword: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
class VerifyTradePasswordDto {
|
class VerifyTradePasswordDto {
|
||||||
|
@IsString()
|
||||||
|
@IsNotEmpty()
|
||||||
tradePassword: string;
|
tradePassword: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue