]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
refactor(broadcast-channel): extract response status registries from switch/case
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 24 Mar 2026 00:43:04 +0000 (01:43 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 24 Mar 2026 00:43:04 +0000 (01:43 +0100)
commit6eb69c8939189af3f6d8df55eb9935afc514262f
treeac88b0a17cf67579c80b1850a9a9ccf1fa3af28e
parentaccb056172b75c281dc5bc6376f9e29762e98c50
refactor(broadcast-channel): extract response status registries from switch/case

Replace 11 repetitive switch/case blocks in commandResponseToResponseStatus
with two static registries:
- emptyResponseCommands: Set of commands where empty response = success
- acceptedStatusCommands: Map of commands to status check predicates

Custom cases (AUTHORIZE, START/STOP_TRANSACTION, HEARTBEAT,
TRANSACTION_EVENT) remain in switch for version-specific logic.

Adding a new command now requires 1 line in the registry instead of
a 5-line case block.
src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts