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.
29 lines
884 B
Go
29 lines
884 B
Go
package router
|
|
|
|
import (
|
|
"bookhoard/internal/handlers"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
func registerQueueRoutes(cfg *Config) {
|
|
e := cfg.Echo
|
|
|
|
// JWT middleware for protected routes
|
|
jwtMiddleware := createJWTMiddleware(cfg)
|
|
|
|
protected := e.Group("/api", jwtMiddleware)
|
|
|
|
// Sync queue management routes (protected - require user auth)
|
|
queue := protected.Group("/queue")
|
|
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)
|
|
}
|