44 lines
1.6 KiB
TypeScript
44 lines
1.6 KiB
TypeScript
import { Module } from "@nestjs/common";
|
||
import { APP_GUARD } from "@nestjs/core";
|
||
import { NotificationsModule } from "./notifications/notifications.module.js";
|
||
import { PreferencesModule } from "./preferences/preferences.module.js";
|
||
import { TemplatesModule } from "./templates/templates.module.js";
|
||
import { GrpcModule } from "./grpc/grpc.module.js";
|
||
import { HealthModule } from "./shared/health/health.module.js";
|
||
import { PermissionGuard } from "./middleware/permission.guard.js";
|
||
import { LifecycleService } from "./shared/lifecycle/lifecycle.service.js";
|
||
import { KafkaConsumerService } from "./shared/kafka/kafka.consumer.js";
|
||
|
||
/**
|
||
* AppModule —— msg 服务根模块。
|
||
*
|
||
* 仲裁依据:
|
||
* - M1:gRPC 50056 启用(GrpcModule 注册 3 controller 共 17 RPC)
|
||
* - HTTP REST + gRPC 双协议入口,共享同一套 Service 单例
|
||
* - KafkaConsumerService 消费 12 类事件触发通知
|
||
*
|
||
* 模块依赖图:
|
||
* AppModule
|
||
* ├─ NotificationsModule(REST + Service)
|
||
* ├─ PreferencesModule(REST + Service)
|
||
* ├─ TemplatesModule(REST + Service)
|
||
* ├─ GrpcModule(gRPC controllers,imports 上述 3 模块获取 Service)
|
||
* ├─ HealthModule(/healthz + /readyz)
|
||
* └─ providers: PermissionGuard(APP_GUARD) + LifecycleService + KafkaConsumerService
|
||
*/
|
||
@Module({
|
||
imports: [
|
||
NotificationsModule,
|
||
PreferencesModule,
|
||
TemplatesModule,
|
||
GrpcModule,
|
||
HealthModule,
|
||
],
|
||
providers: [
|
||
{ provide: APP_GUARD, useClass: PermissionGuard },
|
||
LifecycleService,
|
||
KafkaConsumerService,
|
||
],
|
||
})
|
||
export class AppModule {}
|