refactor(handlers): update all handlers for Echo v5 compatibility
Update all handler functions to use *echo.Context (pointer) instead of echo.Context (value) as required by Echo v5. Changes across all handler files: - analytics.go: Update handler signatures - auth.go: Update authentication handler signatures - book_matching.go: Update matching handler signatures - collections.go: Update collection handler signatures - collections_preview_test.go: Update test signatures - commonhandlers.go: Update common handler signatures - conflicts.go: Update conflict handler signatures - context.go: Update context handler signatures - dashboard.go: Update dashboard handler signatures - devices.go: Update device handler signatures - jobs.go: Update job handler signatures - kobo.go: Update Kobo handler signatures - koreader.go: Update Koreader handler signatures - library.go: Update library handler signatures - matching.go: Update matching handler signatures - media.go: Update media handler signatures - opds.go: Update OPDS handler signatures - progress.go: Update progress handler signatures - queue.go: Update queue handler signatures - refresh_token.go: Update token handler signatures - scanner.go: Update scanner handler signatures - sidecar.go: Update sidecar handler signatures - sync.go: Update sync handler signatures - system_settings.go: Update settings handler signatures - websocket.go: Update WebSocket handler signatures All handlers now properly implement Echo v5's pointer-based context pattern. This change is necessary for type safety and compatibility with Echo v5's improved context handling and WebSocket support.
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/echo/v5"
|
||||
)
|
||||
|
||||
type QueueHandler struct {
|
||||
@@ -50,7 +50,7 @@ type QueueItemResponse struct {
|
||||
ProcessedAt *string `json:"processed_at,omitempty"`
|
||||
}
|
||||
|
||||
func (h *QueueHandler) GetDeviceQueueStats(c echo.Context) error {
|
||||
func (h *QueueHandler) GetDeviceQueueStats(c *echo.Context) error {
|
||||
user := MustGetAuthenticatedUser(c)
|
||||
|
||||
deviceID, err := uuid.Parse(c.Param("device_id"))
|
||||
@@ -81,7 +81,7 @@ func (h *QueueHandler) GetDeviceQueueStats(c echo.Context) error {
|
||||
})
|
||||
}
|
||||
|
||||
func (h *QueueHandler) ListDeviceQueueItems(c echo.Context) error {
|
||||
func (h *QueueHandler) ListDeviceQueueItems(c *echo.Context) error {
|
||||
user := MustGetAuthenticatedUser(c)
|
||||
|
||||
deviceID, err := uuid.Parse(c.Param("device_id"))
|
||||
@@ -146,7 +146,7 @@ func (h *QueueHandler) ListDeviceQueueItems(c echo.Context) error {
|
||||
})
|
||||
}
|
||||
|
||||
func (h *QueueHandler) GetQueueData(c echo.Context) ([]QueueItemResponse, error) {
|
||||
func (h *QueueHandler) GetQueueData(c *echo.Context) ([]QueueItemResponse, error) {
|
||||
user := MustGetAuthenticatedUser(c)
|
||||
|
||||
if user.Role != "admin" {
|
||||
@@ -196,7 +196,7 @@ func (h *QueueHandler) GetQueueData(c echo.Context) ([]QueueItemResponse, error)
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func (h *QueueHandler) ListAllQueueItems(c echo.Context) error {
|
||||
func (h *QueueHandler) ListAllQueueItems(c *echo.Context) error {
|
||||
response, err := h.GetQueueData(c)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -208,7 +208,7 @@ func (h *QueueHandler) ListAllQueueItems(c echo.Context) error {
|
||||
})
|
||||
}
|
||||
|
||||
func (h *QueueHandler) RetryQueueItem(c echo.Context) error {
|
||||
func (h *QueueHandler) RetryQueueItem(c *echo.Context) error {
|
||||
user := MustGetAuthenticatedUser(c)
|
||||
|
||||
itemID, err := uuid.Parse(c.Param("item_id"))
|
||||
@@ -249,7 +249,7 @@ func (h *QueueHandler) RetryQueueItem(c echo.Context) error {
|
||||
})
|
||||
}
|
||||
|
||||
func (h *QueueHandler) DeleteQueueItem(c echo.Context) error {
|
||||
func (h *QueueHandler) DeleteQueueItem(c *echo.Context) error {
|
||||
user := MustGetAuthenticatedUser(c)
|
||||
|
||||
itemID, err := uuid.Parse(c.Param("item_id"))
|
||||
@@ -279,7 +279,7 @@ func (h *QueueHandler) DeleteQueueItem(c echo.Context) error {
|
||||
return c.NoContent(http.StatusNoContent)
|
||||
}
|
||||
|
||||
func (h *QueueHandler) ClearDeviceQueue(c echo.Context) error {
|
||||
func (h *QueueHandler) ClearDeviceQueue(c *echo.Context) error {
|
||||
user := MustGetAuthenticatedUser(c)
|
||||
|
||||
deviceID, err := uuid.Parse(c.Param("device_id"))
|
||||
|
||||
Reference in New Issue
Block a user