Files
photo-live/services/api/src/app-ov.module.ts
T

36 lines
1.5 KiB
TypeScript
Raw Normal View History

// services/api/src/app-ov.module.ts —— OV(海外观众)部署根模块(P2 Task 2 骨架)。
// 与 app-cn.module.ts 同一管线骨架(日志 + request-id + 全局异常过滤器 + 全局
// 校验管道 + /v1/health),但**显式挑选** ov 角色模块:cn 专属域(auth/albums/
// uploads/photos/admin——写路径与 MinIO 上传)不装配;OvPrismaService、公开读、
// sync-inbox、likes/visits、WS 网关自 Task 3+ 起逐个加入(本任务仅骨架,
// feature modules 在后续任务装配)。cn 模块保持原样,两入口互不影响。
import {
type MiddlewareConsumer,
Module,
type NestModule,
ValidationPipe,
} from '@nestjs/common';
import { APP_FILTER, APP_PIPE } from '@nestjs/core';
import { LoggerModule } from 'nestjs-pino';
import { AllExceptionsFilter } from './all-exceptions.filter';
import { HealthController } from './health.controller';
import { RequestIdMiddleware } from './request-id.middleware';
import { createLoggerOptions } from './shared/logger-options';
@Module({
imports: [LoggerModule.forRoot(createLoggerOptions())],
controllers: [HealthController],
providers: [
{ provide: APP_FILTER, useClass: AllExceptionsFilter },
{
provide: APP_PIPE,
useFactory: () => new ValidationPipe({ whitelist: true }),
},
],
})
export class AppOvModule implements NestModule {
configure(consumer: MiddlewareConsumer): void {
consumer.apply(RequestIdMiddleware).forRoutes('*');
}
}