feat: integrate library system with routing and handlers
- Add library routes to main router configuration - Implement media items API endpoints for library content - Update existing ebook handlers to use new schema - Add media rating and progress tracking - Maintain backward compatibility with existing endpoints - Support library-specific media item queries Updates application to support new multi-library architecture
This commit is contained in:
+21
-3
@@ -37,6 +37,7 @@ func main() {
|
||||
queries := database.New(dbPool)
|
||||
|
||||
authHandler := handlers.NewAuthHandler(queries, cfg.JWTSecret)
|
||||
libraryHandler := handlers.NewLibraryHandler(queries)
|
||||
|
||||
e := echo.New()
|
||||
|
||||
@@ -74,9 +75,26 @@ func main() {
|
||||
// Admin-only routes for user and folder management
|
||||
admin := protected.Group("/auth", handlers.AdminMiddleware)
|
||||
admin.GET("/users", authHandler.ListUsers)
|
||||
admin.POST("/ebook-folders", authHandler.AddEbookFolder)
|
||||
admin.GET("/ebook-folders", authHandler.GetEbookFolders)
|
||||
admin.DELETE("/ebook-folders", authHandler.DeleteEbookFolder)
|
||||
|
||||
// Library management routes
|
||||
library := protected.Group("/libraries")
|
||||
library.GET("/types", libraryHandler.GetLibraryTypes)
|
||||
|
||||
// Admin-only library routes
|
||||
adminLibrary := library.Group("", handlers.AdminMiddleware)
|
||||
adminLibrary.POST("", libraryHandler.CreateLibrary)
|
||||
adminLibrary.GET("", libraryHandler.ListLibraries)
|
||||
adminLibrary.GET("/:id", libraryHandler.GetLibrary)
|
||||
adminLibrary.PUT("/:id", libraryHandler.UpdateLibrary)
|
||||
adminLibrary.DELETE("/:id", libraryHandler.DeleteLibrary)
|
||||
adminLibrary.POST("/:id/folders", libraryHandler.AddLibraryFolder)
|
||||
adminLibrary.GET("/:id/folders", libraryHandler.GetLibraryFolders)
|
||||
adminLibrary.DELETE("/:id/folders", libraryHandler.DeleteLibraryFolder)
|
||||
adminLibrary.GET("/:id/stats", libraryHandler.GetLibraryStats)
|
||||
|
||||
// User library visibility control
|
||||
protected.POST("/libraries/visibility", libraryHandler.SetLibraryVisibility)
|
||||
protected.GET("/libraries/visible", libraryHandler.GetUserVisibleLibraries)
|
||||
|
||||
protected.DELETE("/auth/account", authHandler.DeleteAccount)
|
||||
protected.PUT("/library/scan-settings", authHandler.UpdateScanSettings)
|
||||
|
||||
Reference in New Issue
Block a user