Files
gamegroup/src/modules/users/dto/user.dto.ts

32 lines
827 B
TypeScript
Raw Normal View History

import { IsEmail, IsOptional, IsString, MinLength } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
export class UpdateUserDto {
@ApiProperty({ description: '邮箱', required: false })
@IsEmail({}, { message: '邮箱格式不正确' })
@IsOptional()
email?: string;
@ApiProperty({ description: '手机号', required: false })
@IsString()
@IsOptional()
phone?: string;
@ApiProperty({ description: '头像URL', required: false })
@IsString()
@IsOptional()
avatar?: string;
}
export class ChangePasswordDto {
@ApiProperty({ description: '旧密码' })
@IsString()
@IsOptional()
oldPassword: string;
@ApiProperty({ description: '新密码' })
@IsString()
@MinLength(6, { message: '密码至少6个字符' })
newPassword: string;
}