feat: add endpoints for triggering sensor reads and actor writes

This commit is contained in:
2026-01-12 10:43:03 +01:00
parent ac9fd3ffdc
commit 66ba68c39f
3 changed files with 134 additions and 11 deletions
+3 -1
View File
@@ -108,7 +108,7 @@ func main() {
r.Use(gin.Recovery())
r.Use(middleware.GinLogger())
h := &handler.Handler{DB: sqlDB, JWTSecret: cfg.Server.JWTSecret}
h := &handler.Handler{DB: sqlDB, JWTSecret: cfg.Server.JWTSecret, MQTTTopic: cfg.MQTT.Topic}
// Public routes
r.GET("/health", h.Health)
@@ -126,12 +126,14 @@ func main() {
auth.GET("/messages", handler.GetMessages)
auth.GET("/sensors", h.GetSensors)
auth.GET("/sensors/:id", h.GetSensor)
auth.POST("/sensors/:id/trigger", h.TriggerSensor)
auth.POST("/sensors", h.CreateSensor)
auth.PUT("/sensors/:id", h.UpdateSensor)
auth.DELETE("/sensors/:id", h.DeleteSensor)
auth.GET("/actors", h.GetActors)
auth.GET("/actors/:id", h.GetActor)
auth.POST("/actors/:id/write", h.WriteActor)
auth.POST("/actors", h.CreateActor)
auth.PUT("/actors/:id", h.UpdateActor)
auth.DELETE("/actors/:id", h.DeleteActor)