- Update Config struct to replace EbookHandler with MediaHandler, SearchHandler, MatchingHandler - Add CollectionHandler to Config struct - Update RegisterRoutes to call new registration functions - Create registerCollectionsRoutes for 15 collection endpoints - Create registerSearchRoutes for search endpoints (uses MediaHandler.SearchMediaItems, MatchingHandler.QueryBooks) - Create registerMatchingRoutes for 8 matching/linking endpoints - Update registerMediaRoutes to use cfg.MediaHandler (adds 24 media endpoints) - Create registerProgressRoutes for 3 universal progress endpoints All 57 routes preserved and properly registered with correct handlers. No functionality lost, all endpoints work identically. This is Phase 5 of the ebook.go refactoring plan.
19 lines
532 B
Go
19 lines
532 B
Go
package router
|
|
|
|
import (
|
|
"bookhoard/internal/handlers"
|
|
)
|
|
|
|
func registerProgressRoutes(cfg *Config, ebookHandler *handlers.Handler) {
|
|
e := cfg.Echo
|
|
|
|
// JWT middleware for protected routes
|
|
jwtMiddleware := createJWTMiddleware(cfg)
|
|
protected := e.Group("/api", jwtMiddleware)
|
|
|
|
// Universal Progress routes (Phase 1)
|
|
protected.GET("/progress/:id", ebookHandler.GetUniversalProgress)
|
|
protected.POST("/progress/:id", ebookHandler.UpdateUniversalProgress)
|
|
protected.GET("/progress/:id/history", ebookHandler.GetProgressHistory)
|
|
}
|