refactor:重构业务层服务架构

- 重构共享模块,移除冗余DTO定义
- 优化Zulip服务模块,重新组织控制器结构
- 更新用户管理和认证服务
- 移除过时的登录服务测试文件
This commit is contained in:
moyin
2026-01-08 23:05:13 +08:00
parent c2a1c6862d
commit 0f37130832
16 changed files with 38 additions and 54 deletions

View File

@@ -0,0 +1,82 @@
/**
* 通用错误响应 DTO
*
* 功能描述:
* - 定义统一的错误响应格式
* - 提供 Swagger 文档生成支持
* - 标准化全局异常处理响应结构
*
* 职责分离:
* - 错误数据结构:定义统一的错误响应格式
* - 文档生成提供Swagger错误响应文档
*
* 最近修改:
* - 2026-01-08: 文件夹扁平化 - 从dto/子文件夹移动到上级目录 (修改者: moyin)
* - 2026-01-07: 代码规范优化 - 更新注释规范和作者信息
*
* @author moyin
* @version 1.0.2
* @since 2025-12-17
* @lastModified 2026-01-08
*/
import { ApiProperty } from '@nestjs/swagger';
/**
* 通用错误响应 DTO
*
* 职责:
* - 定义全局异常处理的统一响应格式
* - 提供完整的错误信息结构
*
* 主要属性:
* - statusCode - HTTP状态码
* - message - 错误描述信息
* - timestamp - 错误发生时间
* - path - 请求路径(可选)
* - error - 错误代码(可选)
*
* 使用场景:
* - 全局异常过滤器响应
* - API错误信息标准化
* - 客户端错误处理
*/
export class ErrorResponseDto {
@ApiProperty({
description: 'HTTP 状态码',
example: 500,
type: Number
})
statusCode: number;
@ApiProperty({
description: '错误消息',
example: 'Internal server error',
type: String
})
message: string;
@ApiProperty({
description: '错误发生时间',
example: '2025-12-17T15:00:00.000Z',
type: String,
format: 'date-time'
})
timestamp: string;
@ApiProperty({
description: '请求路径',
example: '/api/status',
type: String,
required: false
})
path?: string;
@ApiProperty({
description: '错误代码',
example: 'INTERNAL_ERROR',
type: String,
required: false
})
error?: string;
}