forked from datawhale/whale-town-end
范围: src/business/zulip/README.md - 补充对外提供的接口章节(14个公共方法) - 添加使用的项目内部依赖说明(7个依赖) - 完善核心特性描述(5个特性) - 添加潜在风险评估(4个风险及缓解措施) - 优化文档结构和内容完整性
81 lines
3.2 KiB
TypeScript
81 lines
3.2 KiB
TypeScript
/**
|
||
* Zulip集成业务模块
|
||
*
|
||
* 功能描述:
|
||
* - 提供Zulip账号关联管理业务逻辑
|
||
* - 提供Zulip事件处理业务逻辑
|
||
* - 通过 SESSION_QUERY_SERVICE 接口与 ChatModule 解耦
|
||
*
|
||
* 架构说明:
|
||
* - Business层:专注业务逻辑处理,不包含HTTP协议处理
|
||
* - Controller已迁移到Gateway层(src/gateway/zulip/)
|
||
* - 通过 Core 层接口解耦,不直接依赖其他模块的具体实现
|
||
*
|
||
* 迁移记录:
|
||
* - 2026-01-14: 架构优化 - 将所有Controller迁移到Gateway层,符合四层架构规范 (修改者: moyin)
|
||
* - 2026-01-14: 架构优化 - 移除冗余的DynamicConfigManagerService声明,该服务已由ZulipCoreModule提供 (修改者: moyin)
|
||
* - 2026-01-14: 聊天功能迁移到新的四层架构模块
|
||
* - CleanWebSocketGateway -> gateway/chat/chat.gateway.ts
|
||
* - ZulipService(聊天部分) -> business/chat/chat.service.ts
|
||
* - SessionManagerService -> business/chat/services/chat_session.service.ts
|
||
* - MessageFilterService -> business/chat/services/chat_filter.service.ts
|
||
* - SessionCleanupService -> business/chat/services/chat_cleanup.service.ts
|
||
* - ChatController -> gateway/chat/chat.controller.ts
|
||
* - 2026-01-14: 通过 Core 层接口解耦,不再直接依赖 ChatModule 的具体实现
|
||
*
|
||
* @author angjustinl
|
||
* @version 3.0.0
|
||
* @since 2026-01-06
|
||
* @lastModified 2026-01-14
|
||
*/
|
||
|
||
import { Module } from '@nestjs/common';
|
||
// 业务服务
|
||
import { ZulipEventProcessorService } from './services/zulip_event_processor.service';
|
||
import { ZulipAccountsBusinessService } from './services/zulip_accounts_business.service';
|
||
// 依赖模块
|
||
import { ZulipCoreModule } from '../../core/zulip_core/zulip_core.module';
|
||
import { ZulipAccountsModule } from '../../core/db/zulip_accounts/zulip_accounts.module';
|
||
import { RedisModule } from '../../core/redis/redis.module';
|
||
import { LoggerModule } from '../../core/utils/logger/logger.module';
|
||
import { LoginCoreModule } from '../../core/login_core/login_core.module';
|
||
import { AuthModule } from '../auth/auth.module';
|
||
// 通过接口依赖 ChatModule(解耦)
|
||
import { ChatModule } from '../chat/chat.module';
|
||
import { DynamicConfigManagerService } from '../../core/zulip_core/services/dynamic_config_manager.service';
|
||
|
||
@Module({
|
||
imports: [
|
||
// Zulip核心服务模块
|
||
ZulipCoreModule,
|
||
// Zulip账号关联模块
|
||
ZulipAccountsModule.forRoot(),
|
||
// Redis模块
|
||
RedisModule,
|
||
// 日志模块
|
||
LoggerModule,
|
||
// 登录模块
|
||
LoginCoreModule,
|
||
// 认证模块
|
||
AuthModule,
|
||
// 聊天模块 - 通过 SESSION_QUERY_SERVICE 接口提供会话查询能力
|
||
// ZulipEventProcessorService 依赖接口而非具体实现,实现解耦
|
||
ChatModule,
|
||
],
|
||
providers: [
|
||
// Zulip事件处理服务 - 处理Zulip事件队列消息
|
||
ZulipEventProcessorService,
|
||
// Zulip账号业务服务 - 账号关联管理
|
||
ZulipAccountsBusinessService,
|
||
],
|
||
exports: [
|
||
// 导出事件处理服务
|
||
ZulipEventProcessorService,
|
||
// 导出账号业务服务
|
||
ZulipAccountsBusinessService,
|
||
// 重新导出动态配置管理服务(来自ZulipCoreModule)
|
||
DynamicConfigManagerService,
|
||
],
|
||
})
|
||
export class ZulipModule {}
|