feat: add endpoints for triggering sensor reads and actor writes
This commit is contained in:
+3
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user