generated from CubeCraft-Creations/Tracehound
e00c8dce85
Three bugs surfaced once the camera reported in:
- ListCameras LEFT JOIN returns NULL status columns for a camera with no
status rows yet, which failed scanning into non-nullable int/time fields
(recording_state, online, recorded_at) and emptied the whole list.
COALESCE them (recorded_at falls back to the camera's created_at).
- handleHeartbeat rejected every heartbeat ("cannot unmarshal number into
string") because the node sends a numeric millis() timestamp. The handler
doesn't use it, so drop the Timestamp field and let it be ignored.
- handleAnnounce kept a stale cam-NNN row registered by MAC under the old
(pre-self-id) scheme, so self-id status inserts hit a FOREIGN KEY error.
When a MAC is known under a different id than the node's self-id, migrate:
drop the old row and re-register under the self-id.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>