Merge branch 'develop' into feature/statistics-api

# Conflicts:
#	internal/backend/music.go
#	internal/backend/sync.go
#	internal/server/server.go
#	internal/server/syncHandler.go
#	internal/server/sync_handler_test.go
#	internal/server/test_helpers.go
#	internal/server/zz_music_handler_test.go
This commit is contained in:
2026-06-13 11:51:56 +02:00
9 changed files with 646 additions and 103 deletions
+27
View File
@@ -164,6 +164,33 @@ 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