Files
wwjcloud-nest-v1/wwjcloud/src/common/auth/dto/register.dto.ts
万物街 f30d64e6cc feat: 初始化 WWJ Cloud 企业级框架项目
- 后端:基于 NestJS 的分层架构设计
- 前端:基于 VbenAdmin + Element Plus 的管理系统
- 支持 SaaS + 独立版双架构模式
- 完整的用户权限管理系统
- 系统设置、文件上传、通知等核心功能
- 多租户支持和插件化扩展架构
2025-08-23 13:20:01 +08:00

79 lines
2.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsString, IsNotEmpty, IsOptional, IsInt, IsIn, IsEmail, IsMobilePhone } from 'class-validator';
import { Transform } from 'class-transformer';
export class RegisterDto {
@ApiProperty({ description: '用户名' })
@IsString()
@IsNotEmpty({ message: '用户名不能为空' })
username: string;
@ApiProperty({ description: '手机号' })
@IsString()
@IsNotEmpty({ message: '手机号不能为空' })
@IsMobilePhone('zh-CN', {}, { message: '手机号格式不正确' })
mobile: string;
@ApiProperty({ description: '密码' })
@IsString()
@IsNotEmpty({ message: '密码不能为空' })
password: string;
@ApiProperty({ description: '确认密码' })
@IsString()
@IsNotEmpty({ message: '确认密码不能为空' })
confirmPassword: string;
@ApiPropertyOptional({ description: '昵称' })
@IsOptional()
@IsString()
nickname?: string;
@ApiPropertyOptional({ description: '邮箱' })
@IsOptional()
@IsEmail({}, { message: '邮箱格式不正确' })
email?: string;
@ApiPropertyOptional({ description: '站点ID' })
@IsOptional()
@IsInt()
@Transform(({ value }) => parseInt(value))
siteId?: number;
@ApiPropertyOptional({ description: '推广会员ID' })
@IsOptional()
@IsInt()
@Transform(({ value }) => parseInt(value))
pid?: number;
@ApiPropertyOptional({ description: '性别1男 2女 0未知', default: 0 })
@IsOptional()
@IsIn([0, 1, 2])
@Transform(({ value }) => parseInt(value))
sex?: number = 0;
@ApiPropertyOptional({ description: '注册类型username用户名 mobile手机号 email邮箱', default: 'mobile' })
@IsOptional()
@IsIn(['username', 'mobile', 'email'])
regType?: string = 'mobile';
@ApiPropertyOptional({ description: '短信验证码' })
@IsOptional()
@IsString()
smsCode?: string;
@ApiPropertyOptional({ description: '邮箱验证码' })
@IsOptional()
@IsString()
emailCode?: string;
@ApiPropertyOptional({ description: '图形验证码' })
@IsOptional()
@IsString()
captcha?: string;
@ApiPropertyOptional({ description: '验证码key' })
@IsOptional()
@IsString()
captchaKey?: string;
}