refactor: add type for template charging stations tracking
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 1 Feb 2024 10:22:33 +0000 (11:22 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 1 Feb 2024 10:22:33 +0000 (11:22 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/Bootstrap.ts

index de4389780d2aec671f2f3293ea0dc3a5beb670ba..bd740997ff77a41e8a933909630ba45a23d019cc 100644 (file)
@@ -54,16 +54,18 @@ enum exitCodes {
   gracefulShutdownError = 4
 }
 
+interface TemplateChargingStations {
+  configured: number
+  started: number
+  lastIndex: number
+}
+
 export class Bootstrap extends EventEmitter {
   private static instance: Bootstrap | null = null
   private workerImplementation?: WorkerAbstract<ChargingStationWorkerData>
   private readonly uiServer?: AbstractUIServer
   private storage?: Storage
-  private readonly chargingStationsByTemplate: Map<
-  string,
-  { configured: number, started: number, lastIndex: number }
-  >
-
+  private readonly chargingStationsByTemplate: Map<string, TemplateChargingStations>
   private readonly version: string = version
   private initializedCounters: boolean
   private started: boolean
@@ -81,10 +83,7 @@ export class Bootstrap extends EventEmitter {
     this.started = false
     this.starting = false
     this.stopping = false
-    this.chargingStationsByTemplate = new Map<
-    string,
-    { configured: number, started: number, lastIndex: number }
-    >()
+    this.chargingStationsByTemplate = new Map<string, TemplateChargingStations>()
     this.uiServer = UIServerFactory.getUIServerImplementation(
       Configuration.getConfigurationSection<UIServerConfiguration>(ConfigurationSection.uiServer)
     )