Fixed some small bugs after merge

This commit is contained in:
2026-06-14 11:30:58 +02:00
parent 0894d65ec5
commit 4e5bdc4ee2
21 changed files with 1460 additions and 186 deletions
+3 -30
View File
@@ -63,7 +63,7 @@ func (s *Server) RegisterRoutes() http.Handler {
// ============================================
deprecatedMiddleware := middleware.DeprecationMiddleware
health := NewHealthHandler()
health := NewHealthHandler(s.db)
e.GET("/health", deprecatedMiddleware(health.HealthCheck))
version := NewVersionHandler()
@@ -112,10 +112,10 @@ func (s *Server) RegisterRoutes() http.Handler {
// ============================================
// API v1 Routes with Token Authentication
// ============================================
// Create /api/v1 group
apiV1 := e.Group("/api/v1")
// Public endpoints - no token required
apiV1.POST("/token", func(c *echo.Context) error {
return s.tokenHandler.CreateTokenHandler(c)
@@ -164,33 +164,6 @@ func (s *Server) RegisterRoutes() http.Handler {
// Future: VGMQ endpoints will be added to protectedV1 group
_ = protectedV1 // Use the variable to avoid unused variable error
// ============================================
// API v1 Routes with Token Authentication
// ============================================
// Create /api/v1 group
apiV1 := e.Group("/api/v1")
// Public endpoints - no token required
apiV1.POST("/token", func(c *echo.Context) error {
return s.tokenHandler.CreateTokenHandler(c)
})
apiV1.DELETE("/token", func(c *echo.Context) error {
return s.tokenHandler.DeleteTokenHandler(c)
})
apiV1.POST("/token/cleanup", func(c *echo.Context) error {
return s.tokenHandler.CleanupExpiredSessionsHandler(c)
})
// Protected endpoints - require valid token
// Create token auth middleware with pool access
tokenAuthMiddleware := middleware.TokenAuthMiddleware(s.db.Pool)
// Protected group with token authentication - will be used by VGMQ and Statistics API
_ = apiV1.Group("", tokenAuthMiddleware)
// Note: Future protected endpoints (VGMQ, Statistics) will be added here
routes := e.Router().Routes()
sort.Slice(routes, func(i, j int) bool {
return routes[i].Path < routes[j].Path