1- import { MiddlewareConsumer , Module , NestModule , RequestMethod } from '@nestjs/common' ;
1+ import { Global , MiddlewareConsumer , Module , NestModule , RequestMethod } from '@nestjs/common' ;
22import { TypeOrmModule } from '@nestjs/typeorm' ;
33import { AuthMiddleware } from '../../authorization/auth.middleware.js' ;
44import { GlobalDatabaseContext } from '../../common/application/global-database-context.js' ;
55import { BaseType , UseCaseType } from '../../common/data-injection.tokens.js' ;
66import { LogOutEntity } from '../log-out/log-out.entity.js' ;
77import { UserEntity } from '../user/user.entity.js' ;
8+ import { AiService } from './ai.service.js' ;
9+ import { AmazonBedrockAiProvider } from './amazon-bedrock/amazon-bedrock.ai.provider.js' ;
810import { RequestInfoFromTableWithAIUseCaseV4 } from './use-cases/request-info-from-table-with-ai-v4.use.case.js' ;
911import { UserAIRequestsControllerV2 } from './user-ai-requests-v2.controller.js' ;
12+ import { RequestAISettingsAndWidgetsCreationUseCase } from './use-cases/request-ai-settings-and-widgets-creation.use.case.js' ;
1013
14+ @Global ( )
1115@Module ( {
1216 imports : [ TypeOrmModule . forFeature ( [ UserEntity , LogOutEntity ] ) ] ,
1317 providers : [
@@ -19,11 +23,23 @@ import { UserAIRequestsControllerV2 } from './user-ai-requests-v2.controller.js'
1923 provide : UseCaseType . REQUEST_INFO_FROM_TABLE_WITH_AI_V2 ,
2024 useClass : RequestInfoFromTableWithAIUseCaseV4 ,
2125 } ,
26+ {
27+ provide : UseCaseType . REQUEST_AI_SETTINGS_AND_WIDGETS_CREATION ,
28+ useClass : RequestAISettingsAndWidgetsCreationUseCase ,
29+ } ,
30+ AmazonBedrockAiProvider ,
31+ AiService ,
2232 ] ,
33+ exports : [ AiService , AmazonBedrockAiProvider ] ,
2334 controllers : [ UserAIRequestsControllerV2 ] ,
2435} )
2536export class AIModule implements NestModule {
2637 public configure ( consumer : MiddlewareConsumer ) : any {
27- consumer . apply ( AuthMiddleware ) . forRoutes ( { path : '/ai/v2/request/:connectionId' , method : RequestMethod . POST } ) ;
38+ consumer
39+ . apply ( AuthMiddleware )
40+ . forRoutes (
41+ { path : '/ai/v2/request/:connectionId' , method : RequestMethod . POST } ,
42+ { path : '/ai/v2/setup/:connectionId' , method : RequestMethod . GET } ,
43+ ) ;
2844 }
2945}
0 commit comments