feat: 初始化项目
This commit is contained in:
50
src/users/dto/update-user.dto.ts
Normal file
50
src/users/dto/update-user.dto.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsString, IsEmail, IsOptional, MinLength, IsNotEmpty, IsEnum } from 'class-validator';
|
||||
import { ResponseCode } from 'src/base.dto';
|
||||
import { Gender, User } from '../models/user.model';
|
||||
|
||||
export class UpdateUserDto {
|
||||
@IsString({ message: '用户ID必须是字符串' })
|
||||
@IsNotEmpty({ message: '用户ID不能为空' })
|
||||
@ApiProperty({ description: '用户ID', example: '123' })
|
||||
userId: string;
|
||||
|
||||
@IsString({ message: '用户名必须是字符串' })
|
||||
@MinLength(1, { message: '用户名长度不能少于1个字符' })
|
||||
@IsOptional()
|
||||
@ApiProperty({ description: '用户名', example: '张三' })
|
||||
name: string;
|
||||
|
||||
@IsString({ message: '头像必须是字符串' })
|
||||
@IsOptional()
|
||||
@ApiProperty({ description: '头像', example: 'base64' })
|
||||
avatar: string;
|
||||
|
||||
@IsEnum(Gender, { message: '性别必须是枚举值' })
|
||||
@IsOptional()
|
||||
@ApiProperty({ description: '性别', example: 'male' })
|
||||
gender: Gender;
|
||||
|
||||
|
||||
// 时间戳
|
||||
@IsOptional()
|
||||
@ApiProperty({ description: '出生年月日', example: 1713859200 })
|
||||
birthDate: number;
|
||||
|
||||
}
|
||||
|
||||
export class UpdateUserResponseDto {
|
||||
@ApiProperty({ description: '状态码', example: ResponseCode.SUCCESS })
|
||||
code: ResponseCode;
|
||||
@ApiProperty({ description: '消息', example: 'success' })
|
||||
message: string;
|
||||
@ApiProperty({
|
||||
description: '用户', example: {
|
||||
id: '123',
|
||||
name: '张三',
|
||||
avatar: 'base64',
|
||||
}
|
||||
})
|
||||
data: User | null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user