import { IsString, IsOptional, IsNotEmpty, IsNumber, Matches } from 'class-validator'; import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; export class RecoverByPhoneDto { @ApiProperty({ example: 10001 }) @IsNumber() accountSequence: number; @ApiProperty({ example: '13800138000' }) @IsString() @Matches(/^1[3-9]\d{9}$/, { message: '手机号格式错误' }) phoneNumber: string; @ApiProperty({ example: '123456' }) @IsString() @Matches(/^\d{6}$/, { message: '验证码格式错误' }) smsCode: string; @ApiProperty() @IsString() @IsNotEmpty() newDeviceId: string; @ApiPropertyOptional() @IsOptional() @IsString() deviceName?: string; }