rwadurian/backend/services/identity-service/src/api/dto/request/change-phone.dto.ts

53 lines
1.4 KiB
TypeScript

import { ApiProperty } from '@nestjs/swagger';
import { IsString, Matches } from 'class-validator';
/**
* 发送旧手机验证码请求
*/
export class SendOldPhoneCodeDto {
// 不需要参数,使用当前绑定的手机号
}
/**
* 验证旧手机验证码请求
*/
export class VerifyOldPhoneDto {
@ApiProperty({ example: '123456', description: '旧手机验证码' })
@IsString()
@Matches(/^\d{6}$/, { message: '验证码格式错误' })
smsCode: string;
}
/**
* 发送新手机验证码请求
*/
export class SendNewPhoneCodeDto {
@ApiProperty({ example: '13800138001', description: '新手机号' })
@IsString()
@Matches(/^1[3-9]\d{9}$/, { message: '手机号格式错误' })
newPhoneNumber: string;
@ApiProperty({ description: '验证旧手机后获得的临时令牌' })
@IsString()
changePhoneToken: string;
}
/**
* 确认更换手机号请求
*/
export class ConfirmChangePhoneDto {
@ApiProperty({ example: '13800138001', description: '新手机号' })
@IsString()
@Matches(/^1[3-9]\d{9}$/, { message: '手机号格式错误' })
newPhoneNumber: string;
@ApiProperty({ example: '123456', description: '新手机验证码' })
@IsString()
@Matches(/^\d{6}$/, { message: '验证码格式错误' })
smsCode: string;
@ApiProperty({ description: '验证旧手机后获得的临时令牌' })
@IsString()
changePhoneToken: string;
}