refactor: organize constants
[e-mobility-charging-stations-simulator.git] / src / performance / storage / MongoDBStorage.ts
index 54fc43349b2f3cbe8dbabc36ec3cd53dbc692936..aff757b5c343c58850bc36a9ac990ca37491f683 100644 (file)
@@ -3,9 +3,8 @@
 import { MongoClient } from 'mongodb';
 
 import { Storage } from './Storage';
-import type { Statistics } from '../../types/Statistics';
-import { StorageType } from '../../types/Storage';
-import Constants from '../../utils/Constants';
+import { type Statistics, StorageType } from '../../types';
+import { Constants } from '../../utils';
 
 export class MongoDBStorage extends Storage {
   private readonly client: MongoClient | null;
@@ -24,7 +23,7 @@ export class MongoDBStorage extends Storage {
     try {
       this.checkDBConnection();
       await this.client
-        .db(this.dbName)
+        ?.db(this.dbName)
         .collection<Statistics>(Constants.PERFORMANCE_RECORDS_TABLE)
         .insertOne(performanceStatistics);
     } catch (error) {