feat: 初始化 WWJ Cloud 企业级框架项目
- 后端:基于 NestJS 的分层架构设计 - 前端:基于 VbenAdmin + Element Plus 的管理系统 - 支持 SaaS + 独立版双架构模式 - 完整的用户权限管理系统 - 系统设置、文件上传、通知等核心功能 - 多租户支持和插件化扩展架构
This commit is contained in:
66
wwjcloud/src/common/auth/dto/change-password.dto.ts
Normal file
66
wwjcloud/src/common/auth/dto/change-password.dto.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { IsString, IsNotEmpty, IsOptional, IsIn } from 'class-validator';
|
||||
|
||||
export class ChangePasswordDto {
|
||||
@ApiProperty({ description: '旧密码' })
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '旧密码不能为空' })
|
||||
oldPassword: string;
|
||||
|
||||
@ApiProperty({ description: '新密码' })
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '新密码不能为空' })
|
||||
newPassword: string;
|
||||
|
||||
@ApiProperty({ description: '确认新密码' })
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '确认新密码不能为空' })
|
||||
confirmPassword: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '用户类型:member会员 admin管理员', default: 'member' })
|
||||
@IsOptional()
|
||||
@IsIn(['member', 'admin'])
|
||||
userType?: string = 'member';
|
||||
}
|
||||
|
||||
export class ResetPasswordDto {
|
||||
@ApiProperty({ description: '用户名/手机号/邮箱' })
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '用户标识不能为空' })
|
||||
identifier: string;
|
||||
|
||||
@ApiProperty({ description: '新密码' })
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '新密码不能为空' })
|
||||
newPassword: string;
|
||||
|
||||
@ApiProperty({ description: '确认新密码' })
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '确认新密码不能为空' })
|
||||
confirmPassword: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '用户类型:member会员 admin管理员', default: 'member' })
|
||||
@IsOptional()
|
||||
@IsIn(['member', 'admin'])
|
||||
userType?: string = 'member';
|
||||
|
||||
@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;
|
||||
}
|
||||
3
wwjcloud/src/common/auth/dto/index.ts
Normal file
3
wwjcloud/src/common/auth/dto/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './login.dto';
|
||||
export * from './register.dto';
|
||||
export * from './change-password.dto';
|
||||
33
wwjcloud/src/common/auth/dto/login.dto.ts
Normal file
33
wwjcloud/src/common/auth/dto/login.dto.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { IsString, IsNotEmpty, IsOptional, IsIn } from 'class-validator';
|
||||
|
||||
export class LoginDto {
|
||||
@ApiProperty({ description: '用户名/手机号' })
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '用户名不能为空' })
|
||||
username: string;
|
||||
|
||||
@ApiProperty({ description: '密码' })
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '密码不能为空' })
|
||||
password: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '用户类型:member会员 admin管理员', default: 'member' })
|
||||
@IsOptional()
|
||||
@IsIn(['member', 'admin'])
|
||||
userType?: string = 'member';
|
||||
|
||||
@ApiPropertyOptional({ description: '验证码' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
captcha?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '验证码key' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
captchaKey?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '记住我' })
|
||||
@IsOptional()
|
||||
rememberMe?: boolean;
|
||||
}
|
||||
79
wwjcloud/src/common/auth/dto/register.dto.ts
Normal file
79
wwjcloud/src/common/auth/dto/register.dto.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user