mirror of
https://github.com/xiaoyiweb/YiAi.git
synced 2025-11-16 06:03:43 +08:00
初始化
This commit is contained in:
18
service/src/modules/auth/dto/adminLogin.dto.ts
Normal file
18
service/src/modules/auth/dto/adminLogin.dto.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { IsNotEmpty, MinLength, MaxLength, IsOptional } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
|
||||
export class AdminLoginDto {
|
||||
@ApiProperty({ example: 'super', description: '邮箱' })
|
||||
@IsNotEmpty({ message: '用户名不能为空!' })
|
||||
@MinLength(2, { message: '用户名最短是两位数!' })
|
||||
@MaxLength(30, { message: '用户名最长不得超过30位!' })
|
||||
@IsOptional()
|
||||
username?: string;
|
||||
|
||||
@ApiProperty({ example: '999999', description: '密码' })
|
||||
@IsNotEmpty({ message: '用户密码不能为空!' })
|
||||
@MinLength(6, { message: '用户密码最低需要大于6位数!' })
|
||||
@MaxLength(30, { message: '用户密码最长不能超过30位数!' })
|
||||
password: string;
|
||||
}
|
||||
22
service/src/modules/auth/dto/authLogin.dto.ts
Normal file
22
service/src/modules/auth/dto/authLogin.dto.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { IsNotEmpty, MinLength, MaxLength, IsOptional } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
|
||||
export class UserLoginDto {
|
||||
@ApiProperty({ example: 'super', description: '邮箱' })
|
||||
@IsNotEmpty({ message: '用户名不能为空!' })
|
||||
@MinLength(2, { message: '用户名最短是两位数!' })
|
||||
@MaxLength(30, { message: '用户名最长不得超过30位!' })
|
||||
@IsOptional()
|
||||
username?: string;
|
||||
|
||||
@ApiProperty({ example: 1, description: '用户ID' })
|
||||
@IsOptional()
|
||||
uid?: number;
|
||||
|
||||
@ApiProperty({ example: '999999', description: '密码' })
|
||||
@IsNotEmpty({ message: '用户密码不能为空!' })
|
||||
@MinLength(6, { message: '用户密码最低需要大于6位数!' })
|
||||
@MaxLength(30, { message: '用户密码最长不能超过30位数!' })
|
||||
password: string;
|
||||
}
|
||||
46
service/src/modules/auth/dto/authRegister.dto.ts
Normal file
46
service/src/modules/auth/dto/authRegister.dto.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { IsNotEmpty, MinLength, MaxLength, IsEmail, IsOptional } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
|
||||
export class UserRegisterDto {
|
||||
@ApiProperty({ example: 'cooper', description: '用户名称' })
|
||||
@IsNotEmpty({ message: '用户名不能为空!' })
|
||||
@MinLength(2, { message: '用户名最低需要大于2位数!' })
|
||||
@MaxLength(12, { message: '用户名不得超过12位!' })
|
||||
username?: string;
|
||||
|
||||
@ApiProperty({ example: '123456', description: '用户密码' })
|
||||
@IsNotEmpty({ message: '用户密码不能为空' })
|
||||
@MinLength(6, { message: '用户密码最低需要大于6位数!' })
|
||||
@MaxLength(30, { message: '用户密码最长不能超过30位数!' })
|
||||
password: string;
|
||||
|
||||
@ApiProperty({ example: 'J_longyan@163.com', description: '用户邮箱' })
|
||||
@IsEmail({}, { message: '请填写正确格式的邮箱!' })
|
||||
@IsNotEmpty({ message: '邮箱不能为空!' })
|
||||
email: string;
|
||||
|
||||
@ApiProperty({ example: '5k3n', description: '图形验证码' })
|
||||
@IsNotEmpty({ message: '验证码为空!' })
|
||||
captchaCode: string;
|
||||
|
||||
@ApiProperty({ example: '2313ko423ko', description: '图形验证码KEY' })
|
||||
@IsNotEmpty({ message: '验证ID不能为空!' })
|
||||
captchaId: string;
|
||||
|
||||
@ApiProperty({ example: 'FRJDLJHFNV', description: '用户填写的别人邀请码', required: false })
|
||||
@IsOptional()
|
||||
invitedBy: string;
|
||||
|
||||
@ApiProperty({
|
||||
example: 'https://public-1300678944.cos.ap-shanghai.myqcloud.com/blog/1682571295452image.png',
|
||||
description: '用户头像',
|
||||
required: false,
|
||||
})
|
||||
@IsOptional()
|
||||
avatar: string;
|
||||
|
||||
@ApiProperty({ example: 'default', description: '用户注册来源', required: false })
|
||||
@IsOptional()
|
||||
client: string;
|
||||
}
|
||||
16
service/src/modules/auth/dto/loginByPhone.dt.ts
Normal file
16
service/src/modules/auth/dto/loginByPhone.dt.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { IsNotEmpty, MinLength, MaxLength, IsOptional, IsPhoneNumber } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
|
||||
export class LoginByPhoneDto {
|
||||
@ApiProperty({ example: '19999999', description: '手机号' })
|
||||
@IsNotEmpty({ message: '手机号不能为空!' })
|
||||
@IsPhoneNumber('CN', { message: '手机号格式不正确!' })
|
||||
phone?: string;
|
||||
|
||||
@ApiProperty({ example: '999999', description: '密码' })
|
||||
@IsNotEmpty({ message: '用户密码不能为空!' })
|
||||
@MinLength(6, { message: '用户密码最低需要大于6位数!' })
|
||||
@MaxLength(30, { message: '用户密码最长不能超过30位数!' })
|
||||
password: string;
|
||||
}
|
||||
19
service/src/modules/auth/dto/sendPhoneCode.dto.ts
Normal file
19
service/src/modules/auth/dto/sendPhoneCode.dto.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { IsNotEmpty, MinLength, MaxLength, IsOptional } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
|
||||
export class SendPhoneCodeDto {
|
||||
@ApiProperty({ example: '199999999', description: '手机号' })
|
||||
@IsNotEmpty({ message: '手机号不能为空' })
|
||||
@MinLength(11, { message: '手机号长度为11位' })
|
||||
@MaxLength(11, { message: '手机号长度为11位!' })
|
||||
phone?: string;
|
||||
|
||||
@ApiProperty({ example: '2b4i1b4', description: '图形验证码KEY' })
|
||||
@IsNotEmpty({ message: '验证码KEY不能为空' })
|
||||
captchaId?: string;
|
||||
|
||||
@ApiProperty({ example: '1g4d', description: '图形验证码' })
|
||||
@IsNotEmpty({ message: '验证码不能为空' })
|
||||
captchaCode?: string;
|
||||
}
|
||||
10
service/src/modules/auth/dto/updatePassByOther.dto.ts
Normal file
10
service/src/modules/auth/dto/updatePassByOther.dto.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { IsNotEmpty, MinLength, MaxLength } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
export class UpdatePassByOtherDto {
|
||||
@ApiProperty({ example: '666666', description: '三方用户更新新密码' })
|
||||
@IsNotEmpty({ message: '用户密码不能为空!' })
|
||||
@MinLength(6, { message: '用户密码最低需要大于6位数!' })
|
||||
@MaxLength(30, { message: '用户密码最长不能超过30位数!' })
|
||||
password: string;
|
||||
}
|
||||
16
service/src/modules/auth/dto/updatePassword.dto.ts
Normal file
16
service/src/modules/auth/dto/updatePassword.dto.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { IsNotEmpty, MinLength, MaxLength } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
export class UpdatePasswordDto {
|
||||
@ApiProperty({ example: '123456', description: '用户旧密码' })
|
||||
@IsNotEmpty({ message: '用户密码不能为空!' })
|
||||
@MinLength(6, { message: '用户密码最低需要大于6位数!' })
|
||||
@MaxLength(30, { message: '用户密码最长不能超过30位数!' })
|
||||
oldPassword: string;
|
||||
|
||||
@ApiProperty({ example: '666666', description: '用户更新新密码' })
|
||||
@IsNotEmpty({ message: '用户密码不能为空!' })
|
||||
@MinLength(6, { message: '用户密码最低需要大于6位数!' })
|
||||
@MaxLength(30, { message: '用户密码最长不能超过30位数!' })
|
||||
password: string;
|
||||
}
|
||||
30
service/src/modules/auth/dto/userRegisterByPhone.dto.ts
Normal file
30
service/src/modules/auth/dto/userRegisterByPhone.dto.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { IsNotEmpty, MinLength, MaxLength, IsEmail, IsOptional, IsPhoneNumber } from 'class-validator';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
|
||||
export class UserRegisterByPhoneDto {
|
||||
@ApiProperty({ example: 'cooper', description: '用户名称' })
|
||||
@IsNotEmpty({ message: '用户名不能为空!' })
|
||||
@MinLength(2, { message: '用户名最低需要大于2位数!' })
|
||||
@MaxLength(12, { message: '用户名不得超过12位!' })
|
||||
username?: string;
|
||||
|
||||
@ApiProperty({ example: '123456', description: '用户密码' })
|
||||
@IsNotEmpty({ message: '用户密码不能为空' })
|
||||
@MinLength(6, { message: '用户密码最低需要大于6位数!' })
|
||||
@MaxLength(30, { message: '用户密码最长不能超过30位数!' })
|
||||
password: string;
|
||||
|
||||
@ApiProperty({ example: '19999999999', description: '用户手机号码' })
|
||||
@IsPhoneNumber('CN', { message: '手机号码格式不正确!' })
|
||||
@IsNotEmpty({ message: '手机号码不能为空!' })
|
||||
phone: string;
|
||||
|
||||
@ApiProperty({ example: '152546', description: '手机验证码' })
|
||||
@IsNotEmpty({ message: '手机验证码不能为空!' })
|
||||
phoneCode: string;
|
||||
|
||||
@ApiProperty({ example: 'SNINE', description: '用户邀请码', required: true })
|
||||
@IsOptional()
|
||||
invitedBy: string;
|
||||
}
|
||||
Reference in New Issue
Block a user