forked from datawhale/whale-town-end
范围: src/gateway/auth/ - 在AuthGatewayModule中导入LoginCoreModule - 解决JwtAuthGuard无法注入LoginCoreService的问题 - 确保依赖注入链的完整性
56 lines
1.3 KiB
TypeScript
56 lines
1.3 KiB
TypeScript
/**
|
||
* 认证网关模块
|
||
*
|
||
* 架构层级:Gateway Layer(网关层)
|
||
*
|
||
* 功能描述:
|
||
* - 整合所有认证相关的网关组件
|
||
* - 提供HTTP API接口
|
||
* - 配置认证守卫和中间件
|
||
* - 处理请求验证和响应格式化
|
||
*
|
||
* 职责分离:
|
||
* - 专注于HTTP协议处理和API网关功能
|
||
* - 依赖业务层服务,不包含业务逻辑
|
||
* - 提供统一的API入口和文档
|
||
*
|
||
* 依赖关系:
|
||
* - 依赖 Business Layer 的 AuthModule
|
||
* - 提供 Controller 和 Guard
|
||
*
|
||
* @author moyin
|
||
* @version 2.0.0
|
||
* @since 2026-01-14
|
||
* @lastModified 2026-01-14
|
||
*/
|
||
|
||
import { Module } from '@nestjs/common';
|
||
import { LoginController } from './login.controller';
|
||
import { RegisterController } from './register.controller';
|
||
import { JwtAuthGuard } from './jwt_auth.guard';
|
||
import { AuthModule } from '../../business/auth/auth.module';
|
||
import { LoginCoreModule } from '../../core/login_core/login_core.module';
|
||
|
||
@Module({
|
||
imports: [
|
||
// 导入业务层模块
|
||
AuthModule,
|
||
// 导入核心层模块(JwtAuthGuard需要LoginCoreService)
|
||
LoginCoreModule,
|
||
],
|
||
controllers: [
|
||
// 网关层控制器
|
||
LoginController,
|
||
RegisterController,
|
||
],
|
||
providers: [
|
||
// 认证守卫
|
||
JwtAuthGuard,
|
||
],
|
||
exports: [
|
||
// 导出守卫供其他模块使用
|
||
JwtAuthGuard,
|
||
],
|
||
})
|
||
export class AuthGatewayModule {}
|