refactor(router): Phase 5 - update router package with new handlers

- 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.
This commit is contained in:
2026-02-07 19:50:19 -05:00
parent f87d8fdff5
commit 296c45e870
6 changed files with 136 additions and 11 deletions
+13
View File
@@ -0,0 +1,13 @@
package router
func registerSearchRoutes(cfg *Config) {
e := cfg.Echo
// JWT middleware for protected routes
jwtMiddleware := createJWTMiddleware(cfg)
protected := e.Group("/api", jwtMiddleware)
// Search and query endpoints (all authenticated users)
protected.GET("/media-items/search", cfg.MediaHandler.SearchMediaItems)
protected.POST("/sync/books/query", cfg.MatchingHandler.QueryBooks)
}