X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FBootstrap.ts;h=143bb5c4298ee229fe3c0d8d66ad69eebda37bf6;hb=c3ee95af4edd541595e3873c8aa4c93d38e59474;hp=ce5286acd70de97586b09839d9fb4b45492eae0a;hpb=323e7c9ca1769c7caa98efe25983930e26d4a6a8;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index ce5286ac..143bb5c4 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -3,6 +3,7 @@ import { ChargingStationWorkerData, ChargingStationWorkerMessage, ChargingStationWorkerMessageEvents } from '../types/ChargingStationWorker'; import Configuration from '../utils/Configuration'; +import Statistics from '../types/Statistics'; import { Storage } from '../performance/storage/Storage'; import { StorageFactory } from '../performance/storage/StorageFactory'; import { UIServiceUtils } from './ui-websocket-services/UIServiceUtils'; @@ -17,7 +18,7 @@ import { version } from '../../package.json'; export default class Bootstrap { private static instance: Bootstrap | null = null; - private workerImplementation: WorkerAbstract | null = null; + private workerImplementation: WorkerAbstract | null = null; private readonly uiWebSocketServer!: UIWebSocketServer; private readonly storage!: Storage; private numberOfChargingStations: number; @@ -118,11 +119,11 @@ export default class Bootstrap { }, messageHandler: async (msg: ChargingStationWorkerMessage) => { if (msg.id === ChargingStationWorkerMessageEvents.STARTED) { - this.uiWebSocketServer.chargingStations.add(msg.data.id); + this.uiWebSocketServer.chargingStations.add(msg.data.id as string); } else if (msg.id === ChargingStationWorkerMessageEvents.STOPPED) { - this.uiWebSocketServer.chargingStations.delete(msg.data.id); + this.uiWebSocketServer.chargingStations.delete(msg.data.id as string); } else if (msg.id === ChargingStationWorkerMessageEvents.PERFORMANCE_STATISTICS) { - await this.storage.storePerformanceStatistics(msg.data); + await this.storage.storePerformanceStatistics(msg.data as unknown as Statistics); } } });