A social knowledge tool for researchers built on ATProto

refactor: encapsulate vector database in SearchService

Co-authored-by: aider (anthropic/claude-sonnet-4-20250514) <aider@aider.chat>

+8 -7
+4
src/modules/search/domain/services/SearchService.ts
··· 88 88 } 89 89 } 90 90 91 + async healthCheck(): Promise<Result<boolean>> { 92 + return await this.vectorDatabase.healthCheck(); 93 + } 94 + 91 95 private async enrichUrlsWithContext( 92 96 searchResults: Array<{ 93 97 url: string;
-3
src/shared/infrastructure/http/factories/ServiceFactory.ts
··· 72 72 configService: EnvironmentConfigService; 73 73 cookieService: CookieService; 74 74 searchService: SearchService; 75 - vectorDatabase: IVectorDatabase; 76 75 } 77 76 78 77 // Web app specific services (includes publishers, auth middleware) ··· 95 94 eventPublisher: IEventPublisher; 96 95 createEventSubscriber: (queueName: QueueName) => IEventSubscriber; 97 96 sagaStateStore: ISagaStateStore; 98 - searchService: SearchService; 99 - vectorDatabase: IVectorDatabase; 100 97 } 101 98 102 99 // Legacy interface for backward compatibility
+4 -4
src/shared/infrastructure/processes/SearchWorkerProcess.ts
··· 28 28 } 29 29 await services.redisConnection.ping(); 30 30 31 - // Validate vector database connection 32 - const vectorDbHealthResult = await services.vectorDatabase.healthCheck(); 33 - if (vectorDbHealthResult.isErr() || !vectorDbHealthResult.value) { 34 - throw new Error('Vector database connection required for search worker'); 31 + // Validate search service (which includes vector database health check) 32 + const searchHealthResult = await services.searchService.healthCheck(); 33 + if (searchHealthResult.isErr() || !searchHealthResult.value) { 34 + throw new Error('Search service connection required for search worker'); 35 35 } 36 36 } 37 37