X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fperformance%2Fstorage%2FMikroOrmStorage.ts;h=44be74918fa1d6ed9e50b69f10f6225a09a51b22;hb=cb886184464ed30ee14f538581e511710131b6ef;hp=82bdd23419fde02c82419952c17b2597a5c7c75f;hpb=95b343745d755d2209f028f676c9d25527e7eb4b;p=e-mobility-charging-stations-simulator.git diff --git a/src/performance/storage/MikroOrmStorage.ts b/src/performance/storage/MikroOrmStorage.ts index 82bdd234..44be7491 100644 --- a/src/performance/storage/MikroOrmStorage.ts +++ b/src/performance/storage/MikroOrmStorage.ts @@ -1,14 +1,14 @@ // Copyright Jerome Benoit. 2021. All Rights Reserved. import { Configuration, Connection, IDatabaseDriver, MikroORM, Options } from '@mikro-orm/core'; -import { MikroORMDBType, StorageType } from '../../types/Storage'; +import { TsMorphMetadataProvider } from '@mikro-orm/reflection'; -import Constants from '../../utils/Constants'; import { PerformanceData } from '../../types/orm/entities/PerformanceData'; import { PerformanceRecord } from '../../types/orm/entities/PerformanceRecord'; -import Statistics from '../../types/Statistics'; +import type Statistics from '../../types/Statistics'; +import { MikroORMDBType, StorageType } from '../../types/Storage'; +import Constants from '../../utils/Constants'; import { Storage } from './Storage'; -import { TsMorphMetadataProvider } from '@mikro-orm/reflection'; export class MikroOrmStorage extends Storage { private storageType: StorageType; @@ -54,15 +54,20 @@ export class MikroOrmStorage extends Storage { if (this.storageType === StorageType.SQLITE) { return `${Constants.DEFAULT_PERFORMANCE_RECORDS_DB_NAME}.db`; } - return this.storageUri.pathname.replace(/(?:^\/)|(?:\/$)/g, '') ?? Constants.DEFAULT_PERFORMANCE_RECORDS_DB_NAME; + return ( + this.storageUri.pathname.replace(/(?:^\/)|(?:\/$)/g, '') ?? + Constants.DEFAULT_PERFORMANCE_RECORDS_DB_NAME + ); } - private getOptions(): Configuration> | Options> { + private getOptions(): + | Configuration> + | Options> { return { metadataProvider: TsMorphMetadataProvider, entities: [PerformanceRecord, PerformanceData], type: this.storageType as MikroORMDBType, - clientUrl: this.getClientUrl() + clientUrl: this.getClientUrl(), }; } @@ -75,4 +80,3 @@ export class MikroOrmStorage extends Storage { } } } -