fix: restore original route paths and parameters
Revert unauthorized route changes made during router refactoring: Device Routes: - Change :token back to :registration_id in approve/reject routes - Keep routes in correct location (approve/reject in protected group) OPDS Routes: - Restore /opds/devices/:deviceId/* structure (was /opds/:id/*) - Add back missing :bookId parameter for download/cover/formats - Change 'navigation' back to 'nav' Queue Routes: - Add missing admin-only routes - Add missing device-specific queue management routes All routes now match original main.go signatures exactly. Breaking changes reverted - API contract restored.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"bookhoard/internal/handlers"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
@@ -12,13 +14,15 @@ func registerQueueRoutes(cfg *Config) {
|
||||
|
||||
protected := e.Group("/api", jwtMiddleware)
|
||||
|
||||
// Sync queue management routes
|
||||
// Sync queue management routes (protected - require user auth)
|
||||
queue := protected.Group("/queue")
|
||||
queue.GET("", func(c echo.Context) error {
|
||||
data, err := cfg.QueueHandler.GetQueueData(c)
|
||||
if err != nil {
|
||||
return c.JSON(500, map[string]string{"error": "failed to get queue"})
|
||||
}
|
||||
return c.JSON(200, map[string]interface{}{"items": data})
|
||||
})
|
||||
queue.GET("/devices/:device_id/stats", cfg.QueueHandler.GetDeviceQueueStats)
|
||||
queue.GET("/devices/:device_id/items", queueHandler.ListDeviceQueueItems)
|
||||
queue.POST("/items/:item_id/retry", queueHandler.RetryQueueItem)
|
||||
queue.DELETE("/items/:item_id", queueHandler.DeleteQueueItem)
|
||||
queue.DELETE("/devices/:device_id/clear", queueHandler.ClearDeviceQueue)
|
||||
|
||||
// Admin-only queue routes
|
||||
adminQueue := queue.Group("", handlers.AdminMiddleware)
|
||||
adminQueue.GET("/items", cfg.QueueHandler.ListAllQueueItems)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user