diff --git a/internal/handlers/ebook.go b/internal/handlers/ebook.go index d7092ae..03255d3 100644 --- a/internal/handlers/ebook.go +++ b/internal/handlers/ebook.go @@ -70,6 +70,35 @@ func parseDate(dateStr string) time.Time { func SetupRoutes(g *echo.Group, db *database.Queries, connManager *wsync.ConnectionManager) *Handler { h := NewHandler(db, connManager) + // Collections API routes + collectionHandler := NewCollectionHandler(db) + collections := g.Group("/collections") + collections.GET("", collectionHandler.GetCollections) + collections.POST("", collectionHandler.CreateCollection) + collections.GET("/:id", collectionHandler.GetCollection) + collections.PUT("/:id", collectionHandler.UpdateCollection) + collections.DELETE("/:id", collectionHandler.DeleteCollection) + collections.GET("/:id/books", collectionHandler.GetBookCollections) + collections.POST("/:id/books", collectionHandler.AddBooks) + collections.DELETE("/:id/books/:bookId", collectionHandler.RemoveBook) + + // Device shelf mapping routes + deviceCollections := g.Group("/devices/:id/collections") + deviceCollections.GET("", collectionHandler.GetDeviceMappings) + deviceCollections.POST("", collectionHandler.CreateDeviceMapping) + deviceCollections.PUT("/:collectionId", collectionHandler.UpdateDeviceMapping) + deviceCollections.DELETE("/:collectionId", collectionHandler.DeleteDeviceMapping) + + // Book matching and linking routes + g.POST("/sync/books/query", h.QueryBooks) + g.POST("/devices/:deviceId/sync/link-book", h.LinkBook) + g.GET("/devices/:deviceId/sync/unlinked-books", h.GetUnlinkedBooks) + g.GET("/devices/:id/file-aliases", h.GetDeviceFileAliases) + g.POST("/devices/:id/file-aliases", h.CreateDeviceFileAlias) + g.PUT("/devices/:id/file-aliases/:aliasId", h.UpdateDeviceFileAlias) + g.DELETE("/devices/:id/file-aliases/:aliasId", h.DeleteDeviceFileAlias) + g.GET("/books/match", h.GetBookMatches) + // Media item routes (all authenticated users) g.GET("/media-items", h.ListMediaItems) g.GET("/media-items/filtered", h.ListMediaItemsFiltered)