fix(GOV-009): 完成脚手架审查整改
This commit is contained in:
@@ -5,14 +5,17 @@ import type {
|
||||
HealthResponseDto,
|
||||
} from '../../../libs/http-contracts/src/health.dto';
|
||||
|
||||
/** 依赖注入令牌避免健康服务耦合 ioredis 或 mysql2 客户端。 */
|
||||
export const REDIS_HEALTH_PORT = Symbol('REDIS_HEALTH_PORT');
|
||||
export const MYSQL_HEALTH_PORT = Symbol('MYSQL_HEALTH_PORT');
|
||||
|
||||
/** 健康端口只要求只读检查,便于禁用态和测试实现遵循同一契约。 */
|
||||
export interface DependencyHealthPort {
|
||||
check(): Promise<DependencyHealthDto>;
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
/** 聚合依赖状态并统一清洗底层错误,禁止连接信息进入 HTTP 响应。 */
|
||||
export class HealthService {
|
||||
constructor(
|
||||
@Inject(REDIS_HEALTH_PORT) private readonly redis: DependencyHealthPort,
|
||||
|
||||
Reference in New Issue
Block a user