fix(kyc): 为 SubmitRealNameDto 添加 class-validator 装饰器
修复 ValidationPipe whitelist 模式下属性被过滤的问题 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
181d11d656
commit
de17231f61
|
|
@ -18,7 +18,9 @@ import {
|
||||||
ApiResponse,
|
ApiResponse,
|
||||||
ApiConsumes,
|
ApiConsumes,
|
||||||
ApiBody,
|
ApiBody,
|
||||||
|
ApiProperty,
|
||||||
} from '@nestjs/swagger';
|
} from '@nestjs/swagger';
|
||||||
|
import { IsString, IsNotEmpty, Length, Matches } from 'class-validator';
|
||||||
import { KycApplicationService } from '@/application/services/kyc-application.service';
|
import { KycApplicationService } from '@/application/services/kyc-application.service';
|
||||||
import {
|
import {
|
||||||
JwtAuthGuard,
|
JwtAuthGuard,
|
||||||
|
|
@ -29,7 +31,18 @@ import {
|
||||||
// ========== DTO 定义 ==========
|
// ========== DTO 定义 ==========
|
||||||
|
|
||||||
class SubmitRealNameDto {
|
class SubmitRealNameDto {
|
||||||
|
@ApiProperty({ description: '真实姓名', example: '张三' })
|
||||||
|
@IsString()
|
||||||
|
@IsNotEmpty({ message: '姓名不能为空' })
|
||||||
|
@Length(2, 50, { message: '姓名长度需在2-50个字符之间' })
|
||||||
realName: string;
|
realName: string;
|
||||||
|
|
||||||
|
@ApiProperty({ description: '身份证号码', example: '110101199001011234' })
|
||||||
|
@IsString()
|
||||||
|
@IsNotEmpty({ message: '身份证号不能为空' })
|
||||||
|
@Matches(/^[1-9]\d{5}(18|19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}[\dXx]$/, {
|
||||||
|
message: '身份证号格式不正确',
|
||||||
|
})
|
||||||
idCardNumber: string;
|
idCardNumber: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue