refactor: migrate backend framework from Express to NestJS
This commit is contained in:
31
src/auth/dto/index.ts
Normal file
31
src/auth/dto/index.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { IsString, IsNotEmpty, MinLength, IsEmail, IsOptional } from 'class-validator';
|
||||
|
||||
export class LoginDto {
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '用户名不能为空' })
|
||||
username: string;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '密码不能为空' })
|
||||
password: string;
|
||||
}
|
||||
|
||||
export class ChangePasswordDto {
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '当前密码不能为空' })
|
||||
currentPassword: string;
|
||||
|
||||
@IsString()
|
||||
@MinLength(6, { message: '新密码长度至少为6位' })
|
||||
newPassword: string;
|
||||
}
|
||||
|
||||
export class UpdateProfileDto {
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '姓名不能为空' })
|
||||
name: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsEmail({}, { message: '邮箱格式不正确' })
|
||||
email?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user