fixed up di
This commit is contained in:
parent
d63025de90
commit
8550b1de57
5 changed files with 19 additions and 56 deletions
|
|
@ -1,23 +1,5 @@
|
|||
import { MongoDBClient } from './client';
|
||||
import type { ConnectionEvents, MongoDBClientConfig } from './types';
|
||||
// This factory is no longer needed when using Awilix DI
|
||||
// The MongoDBClient is now registered directly in the DI container
|
||||
// See: libs/core/di/src/awilix-container.ts
|
||||
|
||||
/**
|
||||
* Factory function to create a MongoDB client instance
|
||||
*/
|
||||
export function createMongoDBClient(config: MongoDBClientConfig, logger?: any, events?: ConnectionEvents): MongoDBClient {
|
||||
return new MongoDBClient(config, logger, events);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and connect a MongoDB client
|
||||
*/
|
||||
export async function createAndConnectMongoDBClient(
|
||||
config: MongoDBClientConfig,
|
||||
logger?: any,
|
||||
events?: ConnectionEvents
|
||||
): Promise<MongoDBClient> {
|
||||
const client = createMongoDBClient(config, logger, events);
|
||||
this.logger = logger || console; // Fallback to console if no logger provided
|
||||
await client.connect();
|
||||
return client;
|
||||
}
|
||||
export { MongoDBClient } from './client';
|
||||
Loading…
Add table
Add a link
Reference in a new issue