ec-nest/src/users/dto.ts
liuyun 24790e8985 feat: add Swagger API docs (/docs) with DTO schemas
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-10 21:39:37 +08:00

79 lines
1.6 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 { IsNotEmpty, IsOptional, IsString } from 'class-validator';
export class CreateUserDto {
@ApiProperty({ description: '用户名' })
@IsString()
@IsNotEmpty()
username!: string;
@ApiProperty({ description: '初始密码' })
@IsString()
@IsNotEmpty()
password!: string;
@ApiPropertyOptional({ description: '昵称' })
@IsOptional()
@IsString()
nickname?: string;
@ApiPropertyOptional({ description: '邮箱' })
@IsOptional()
@IsString()
email?: string;
@ApiPropertyOptional({ description: '手机号' })
@IsOptional()
@IsString()
phone?: string;
@ApiPropertyOptional({ description: '头像' })
@IsOptional()
@IsString()
avatar?: string;
@ApiPropertyOptional({ description: '所属部门 code' })
@IsOptional()
@IsString()
orgCode?: string;
}
export class UpdateUserDto {
@ApiPropertyOptional({ description: '昵称' })
@IsOptional()
@IsString()
nickname?: string;
@ApiPropertyOptional({ description: '邮箱' })
@IsOptional()
@IsString()
email?: string;
@ApiPropertyOptional({ description: '手机号' })
@IsOptional()
@IsString()
phone?: string;
@ApiPropertyOptional({ description: '头像' })
@IsOptional()
@IsString()
avatar?: string;
@ApiPropertyOptional({ description: '所属部门 code' })
@IsOptional()
@IsString()
orgCode?: string;
@ApiPropertyOptional({ description: '状态:enabled/disabled/locked' })
@IsOptional()
@IsString()
status?: string;
}
export class ResetPasswordDto {
@ApiProperty({ description: '新密码' })
@IsString()
@IsNotEmpty()
password!: string;
}