router: register SidecarHandler routes for system config and device sidecar
Phase 1: Register routes that were defined but never connected - Add GET/PUT /api/system/config routes (admin-only) for system configuration in new internal/router/system.go - Add GET /api/devices/:id/sidecar routes for device sidecar config - Add SidecarHandler to router Config struct - Instantiate SidecarHandler in main.go with config for fallback support These routes were implemented in handlers/sidecar.go but never registered, breaking the ability to configure base URLs for device sync.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"bookhoard/internal/handlers"
|
||||
)
|
||||
|
||||
func registerSystemRoutes(cfg *Config) {
|
||||
e := cfg.Echo
|
||||
|
||||
// JWT middleware
|
||||
jwtMiddleware := createJWTMiddleware(cfg)
|
||||
|
||||
// Protected routes (admin-only)
|
||||
protected := e.Group("/api", jwtMiddleware)
|
||||
system := protected.Group("/system", handlers.AdminMiddleware)
|
||||
|
||||
// System configuration routes (admin-only)
|
||||
system.GET("/config", cfg.SidecarHandler.GetSystemConfiguration)
|
||||
system.PUT("/config", cfg.SidecarHandler.UpdateSystemConfiguration)
|
||||
}
|
||||
Reference in New Issue
Block a user