/** * 管理员响应 DTO * * 功能描述: * - 定义管理员相关接口的响应格式 * - 提供统一的API响应结构 * - 支持Swagger文档自动生成 * * 职责分离: * - 响应数据结构定义 * - API文档生成支持 * - 类型安全保障 * * 最近修改: * - 2026-01-08: 注释规范优化 - 为所有DTO类添加类注释,完善文档说明 (修改者: moyin) * - 2026-01-08: 文件夹扁平化 - 从dto/子文件夹移动到上级目录 (修改者: moyin) * - 2026-01-07: 代码规范优化 - 修正文件命名规范,更新作者信息和修改记录 * * @author moyin * @version 1.0.3 * @since 2025-12-19 * @lastModified 2026-01-08 */ import { ApiProperty } from '@nestjs/swagger'; /** * 管理员登录响应DTO * * 功能描述: * 定义管理员登录接口的响应数据结构 * * 使用场景: * - POST /admin/auth/login 接口的响应体 * - 包含登录状态、Token和管理员基本信息 */ export class AdminLoginResponseDto { @ApiProperty({ description: '是否成功', example: true }) success: boolean; @ApiProperty({ description: '消息', example: '登录成功' }) message: string; @ApiProperty({ description: 'JWT Token', example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' }) token?: string; @ApiProperty({ description: '管理员信息', required: false }) admin?: { id: string; username: string; email: string; role: number; }; } /** * 管理员用户列表响应DTO * * 功能描述: * 定义获取用户列表接口的响应数据结构 * * 使用场景: * - GET /admin/users 接口的响应体 * - 包含用户列表和分页信息 */ export class AdminUsersResponseDto { @ApiProperty({ description: '是否成功', example: true }) success: boolean; @ApiProperty({ description: '消息', example: '获取用户列表成功' }) message: string; @ApiProperty({ description: '用户列表', type: 'array' }) users?: Array<{ id: string; username: string; email: string; phone: string; role: number; status: string; created_at: string; updated_at: string; }>; @ApiProperty({ description: '总数', example: 100 }) total?: number; @ApiProperty({ description: '偏移量', example: 0 }) offset?: number; @ApiProperty({ description: '限制数量', example: 100 }) limit?: number; } /** * 管理员用户详情响应DTO * * 功能描述: * 定义获取单个用户详情接口的响应数据结构 * * 使用场景: * - GET /admin/users/:id 接口的响应体 * - 包含用户的详细信息 */ export class AdminUserResponseDto { @ApiProperty({ description: '是否成功', example: true }) success: boolean; @ApiProperty({ description: '消息', example: '获取用户详情成功' }) message: string; @ApiProperty({ description: '用户信息', required: false }) user?: { id: string; username: string; email: string; phone: string; role: number; status: string; created_at: string; updated_at: string; last_login_at?: string; }; } /** * 管理员通用响应DTO * * 功能描述: * 定义管理员操作的通用响应数据结构 * * 使用场景: * - 各种管理员操作接口的通用响应体 * - 包含操作状态和消息信息 */ export class AdminCommonResponseDto { @ApiProperty({ description: '是否成功', example: true }) success: boolean; @ApiProperty({ description: '消息', example: '操作成功' }) message: string; } /** * 管理员运行日志响应DTO * * 功能描述: * 定义获取系统运行日志接口的响应数据结构 * * 使用场景: * - GET /admin/logs/runtime 接口的响应体 * - 包含系统运行日志内容 */ export class AdminRuntimeLogsResponseDto { @ApiProperty({ description: '是否成功', example: true }) success: boolean; @ApiProperty({ description: '消息', example: '获取日志成功' }) message: string; @ApiProperty({ description: '日志内容', type: 'array', items: { type: 'string' } }) logs?: string[]; @ApiProperty({ description: '返回行数', example: 200 }) lines?: number; }