From 9bef2469d10c33cab66b8e62d8677222ef25ff45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Thu, 5 Mar 2026 11:04:36 +0100 Subject: [PATCH] refactor: rename RecordedEvent fields to snake_case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit deviceIndex → device_index deviceName → device_name actuatorIndex → actuator_index actuatorType → actuator_type Co-Authored-By: Claude Sonnet 4.6 --- packages/frontend/src/routes/play/+page.svelte | 16 ++++++++-------- packages/types/src/index.ts | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/frontend/src/routes/play/+page.svelte b/packages/frontend/src/routes/play/+page.svelte index 3260e1a..1ef7096 100644 --- a/packages/frontend/src/routes/play/+page.svelte +++ b/packages/frontend/src/routes/play/+page.svelte @@ -127,10 +127,10 @@ recordedEvents.push({ timestamp, - deviceIndex: device.info.index, - deviceName: device.name, - actuatorIndex: actuatorIdx, - actuatorType: actuator.outputType, + device_index: device.info.index, + device_name: device.name, + actuator_index: actuatorIdx, + actuator_type: actuator.outputType, value: (value / actuator.maxSteps) * 100, // Normalize to 0-100 }); } @@ -313,16 +313,16 @@ function executeEvent(event: RecordedEvent) { // Get mapped device - const device = deviceMappings.get(event.deviceName); + const device = deviceMappings.get(event.device_name); if (!device) { - console.warn(`No device mapping for: ${event.deviceName}`); + console.warn(`No device mapping for: ${event.device_name}`); return; } // Find matching actuator by type - const actuator = device.actuators.find((a) => a.outputType === event.actuatorType); + const actuator = device.actuators.find((a) => a.outputType === event.actuator_type); if (!actuator) { - console.warn(`Actuator type ${event.actuatorType} not found on ${device.name}`); + console.warn(`Actuator type ${event.actuator_type} not found on ${device.name}`); return; } diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index c3fab0a..4b129db 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -140,10 +140,10 @@ export interface Stats { export interface RecordedEvent { timestamp: number; - deviceIndex: number; - deviceName: string; - actuatorIndex: number; - actuatorType: string; + device_index: number; + device_name: string; + actuator_index: number; + actuator_type: string; value: number; }