2024-02-28 17:02:46 +08:00
|
|
|
import { ApiProperty } from '@nestjs/swagger';
|
2024-02-28 08:32:35 +08:00
|
|
|
|
2024-03-01 16:00:42 +08:00
|
|
|
import { IsOptional, IsString, Matches, MaxLength, MinLength } from 'class-validator';
|
2024-02-28 08:32:35 +08:00
|
|
|
|
|
|
|
export class LoginDto {
|
|
|
|
@ApiProperty({ description: '手机号/邮箱' })
|
2024-03-01 16:00:42 +08:00
|
|
|
@IsOptional()
|
2024-02-28 17:02:46 +08:00
|
|
|
username: string;
|
2024-02-28 08:32:35 +08:00
|
|
|
|
|
|
|
@ApiProperty({ description: '密码', example: 'a123456' })
|
|
|
|
@IsString()
|
2024-03-29 14:41:54 +08:00
|
|
|
@Matches(/^\S*(?=\S{6,})(?=\S*\d)(?=\S*[A-Za-z])\S*$/, { message: '密码错误' })
|
2024-02-28 08:32:35 +08:00
|
|
|
@MinLength(6)
|
2024-02-28 17:02:46 +08:00
|
|
|
password: string;
|
2024-02-28 08:32:35 +08:00
|
|
|
|
2024-03-21 15:03:07 +08:00
|
|
|
@ApiProperty({ description: '验证码标识,手机端不需要' })
|
2024-03-01 16:00:42 +08:00
|
|
|
@IsOptional()
|
2024-02-28 17:02:46 +08:00
|
|
|
captchaId: string;
|
2024-02-28 08:32:35 +08:00
|
|
|
|
|
|
|
@ApiProperty({ description: '用户输入的验证码' })
|
2024-03-01 16:00:42 +08:00
|
|
|
@IsOptional()
|
2024-02-28 08:32:35 +08:00
|
|
|
@MinLength(4)
|
|
|
|
@MaxLength(4)
|
2024-02-28 17:02:46 +08:00
|
|
|
verifyCode: string;
|
2024-02-28 08:32:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export class RegisterDto {
|
|
|
|
@ApiProperty({ description: '账号' })
|
|
|
|
@IsString()
|
2024-02-28 17:02:46 +08:00
|
|
|
username: string;
|
2024-02-28 08:32:35 +08:00
|
|
|
|
|
|
|
@ApiProperty({ description: '密码' })
|
|
|
|
@IsString()
|
|
|
|
@Matches(/^\S*(?=\S{6,})(?=\S*\d)(?=\S*[A-Za-z])\S*$/)
|
|
|
|
@MinLength(6)
|
|
|
|
@MaxLength(16)
|
2024-02-28 17:02:46 +08:00
|
|
|
password: string;
|
2024-02-28 08:32:35 +08:00
|
|
|
|
|
|
|
@ApiProperty({ description: '语言', examples: ['EN', 'ZH'] })
|
|
|
|
@IsString()
|
2024-02-28 17:02:46 +08:00
|
|
|
lang: string;
|
2024-02-28 08:32:35 +08:00
|
|
|
}
|