mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-17 20:09:41 +02:00
fix(matrix-mana-bot): make service modules global for DI
Register TodoModule, CalendarModule, AiModule, and ClockModule as global modules so their services are available throughout the app. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
2a03a7ce41
commit
8370005b25
2 changed files with 40 additions and 35 deletions
|
|
@ -16,40 +16,52 @@ import { TodoModule, CalendarModule, AiModule, ClockModule } from '@manacore/bot
|
|||
load: [configuration],
|
||||
}),
|
||||
|
||||
// Business Logic Modules from shared package
|
||||
TodoModule.registerAsync({
|
||||
imports: [ConfigModule],
|
||||
useFactory: (config: ConfigService) => ({
|
||||
storagePath: config.get('services.todo.storagePath'),
|
||||
// Business Logic Modules from shared package (global: true makes them available everywhere)
|
||||
{
|
||||
...TodoModule.registerAsync({
|
||||
imports: [ConfigModule],
|
||||
useFactory: (config: ConfigService) => ({
|
||||
storagePath: config.get('services.todo.storagePath'),
|
||||
}),
|
||||
inject: [ConfigService],
|
||||
}),
|
||||
inject: [ConfigService],
|
||||
}),
|
||||
global: true,
|
||||
},
|
||||
|
||||
CalendarModule.registerAsync({
|
||||
imports: [ConfigModule],
|
||||
useFactory: (config: ConfigService) => ({
|
||||
storagePath: config.get('services.calendar.storagePath'),
|
||||
{
|
||||
...CalendarModule.registerAsync({
|
||||
imports: [ConfigModule],
|
||||
useFactory: (config: ConfigService) => ({
|
||||
storagePath: config.get('services.calendar.storagePath'),
|
||||
}),
|
||||
inject: [ConfigService],
|
||||
}),
|
||||
inject: [ConfigService],
|
||||
}),
|
||||
global: true,
|
||||
},
|
||||
|
||||
AiModule.registerAsync({
|
||||
imports: [ConfigModule],
|
||||
useFactory: (config: ConfigService) => ({
|
||||
baseUrl: config.get('services.ai.baseUrl'),
|
||||
defaultModel: config.get('services.ai.defaultModel'),
|
||||
timeout: config.get('services.ai.timeout'),
|
||||
{
|
||||
...AiModule.registerAsync({
|
||||
imports: [ConfigModule],
|
||||
useFactory: (config: ConfigService) => ({
|
||||
baseUrl: config.get('services.ai.baseUrl'),
|
||||
defaultModel: config.get('services.ai.defaultModel'),
|
||||
timeout: config.get('services.ai.timeout'),
|
||||
}),
|
||||
inject: [ConfigService],
|
||||
}),
|
||||
inject: [ConfigService],
|
||||
}),
|
||||
global: true,
|
||||
},
|
||||
|
||||
ClockModule.registerAsync({
|
||||
imports: [ConfigModule],
|
||||
useFactory: (config: ConfigService) => ({
|
||||
apiUrl: config.get('services.clock.apiUrl'),
|
||||
{
|
||||
...ClockModule.registerAsync({
|
||||
imports: [ConfigModule],
|
||||
useFactory: (config: ConfigService) => ({
|
||||
apiUrl: config.get('services.clock.apiUrl'),
|
||||
}),
|
||||
inject: [ConfigService],
|
||||
}),
|
||||
inject: [ConfigService],
|
||||
}),
|
||||
global: true,
|
||||
},
|
||||
|
||||
// Gateway-specific modules
|
||||
BotModule,
|
||||
|
|
|
|||
|
|
@ -1,16 +1,9 @@
|
|||
import { Module, forwardRef } from '@nestjs/common';
|
||||
import { OrchestrationService } from './orchestration.service';
|
||||
import { BotModule } from '../bot/bot.module';
|
||||
import { AiModule, TodoModule, CalendarModule } from '@manacore/bot-services';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
forwardRef(() => BotModule),
|
||||
// Import service modules so their services are available
|
||||
AiModule,
|
||||
TodoModule,
|
||||
CalendarModule,
|
||||
],
|
||||
imports: [forwardRef(() => BotModule)],
|
||||
providers: [OrchestrationService],
|
||||
exports: [OrchestrationService],
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue