feat(sync): cn event coverage, bootstrap and outbox sender
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
// services/api/src/prisma-ov/ —— OV 库(photo_ov)的可注入封装(P2 Task 3)。
|
||||
// 与 cn 侧 PrismaModule 的两点刻意差异(执行注意 §双数据库连接):
|
||||
// 1. 非 @Global——按模块显式 import(SyncInboxModule 等_ov 角色模块),
|
||||
// 防止 cn 角色模块误注入 ov 客户端;
|
||||
// 2. 独立类名 OvPrismaService——两库同库不同 schema(@photo/db-ov 生成的
|
||||
// 独立客户端),DI 令牌不同才可并存于同一代码库。
|
||||
import { Injectable, Module, type OnModuleDestroy, type OnModuleInit } from '@nestjs/common';
|
||||
import { PrismaClient } from '@photo/db-ov';
|
||||
|
||||
@Injectable()
|
||||
export class OvPrismaService
|
||||
extends PrismaClient
|
||||
implements OnModuleInit, OnModuleDestroy
|
||||
{
|
||||
async onModuleInit(): Promise<void> {
|
||||
await this.$connect();
|
||||
}
|
||||
|
||||
async onModuleDestroy(): Promise<void> {
|
||||
await this.$disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
@Module({
|
||||
providers: [OvPrismaService],
|
||||
exports: [OvPrismaService],
|
||||
})
|
||||
export class OvPrismaModule {}
|
||||
Reference in New Issue
Block a user