generated from CubeCraft-Creations/Tracehound
hub: actually send start/stop commands over MQTT
The /cameras/{id}/start and /stop handlers only wrote a recording_events
row — they never published the command, so the camera never recorded.
Add Subscriber.PublishCommand (publishes {"command":...} to
remoterig/cameras/<id>/command, which the XIAO forwards to the ESP-01S),
thread a CommandPublisher into the recording handlers, and wire mqttSub in
via apiRouter. Tests pass nil (publish skipped).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -26,8 +26,8 @@ func setupTestRouter(t *testing.T) (*db.DB, chi.Router) {
|
||||
r.Get("/cameras", ListCameras(database))
|
||||
r.Post("/cameras", RegisterCamera(database))
|
||||
r.Get("/cameras/{id}", GetCameraDetail(database))
|
||||
r.Post("/cameras/{id}/start", StartRecording(database))
|
||||
r.Post("/cameras/{id}/stop", StopRecording(database))
|
||||
r.Post("/cameras/{id}/start", StartRecording(database, nil))
|
||||
r.Post("/cameras/{id}/stop", StopRecording(database, nil))
|
||||
r.Post("/cameras/{id}/status", PushStatus(database))
|
||||
|
||||
return database, r
|
||||
|
||||
Reference in New Issue
Block a user