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:
2026-03-06 14:00:28 -05:00
parent 784326e2c4
commit 1e05470fbb
25 changed files with 213 additions and 213 deletions
+12 -12
View File
@@ -9,7 +9,7 @@ import (
"github.com/google/uuid"
"github.com/jackc/pgx/v5/pgtype"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v5"
)
// Book matching service (added to Handler struct in scanner.go initialization)
@@ -40,7 +40,7 @@ func toFloat8(f float64) pgtype.Float8 {
}
// QueryBooks handles POST /api/sync/books/query
func (h *Handler) QueryBooks(c echo.Context) error {
func (h *Handler) QueryBooks(c *echo.Context) error {
matchingService := h.getMatchingService()
var req services.BookQueryRequest
@@ -61,7 +61,7 @@ func (h *Handler) QueryBooks(c echo.Context) error {
}
// LinkBook handles POST /api/sync/link-book
func (h *Handler) LinkBook(c echo.Context) error {
func (h *Handler) LinkBook(c *echo.Context) error {
matchingService := h.getMatchingService()
var req services.LinkBookRequest
@@ -101,7 +101,7 @@ func (h *Handler) LinkBook(c echo.Context) error {
}
// GetUnlinkedBooks handles GET /api/sync/unlinked-books
func (h *Handler) GetUnlinkedBooks(c echo.Context) error {
func (h *Handler) GetUnlinkedBooks(c *echo.Context) error {
matchingService := h.getMatchingService()
deviceIDStr := c.Param("deviceId")
@@ -126,7 +126,7 @@ func (h *Handler) GetUnlinkedBooks(c echo.Context) error {
}
// GetDeviceFileAliases handles GET /api/devices/:id/file-aliases
func (h *Handler) GetDeviceFileAliases(c echo.Context) error {
func (h *Handler) GetDeviceFileAliases(c *echo.Context) error {
deviceIDStr := c.Param("id")
deviceID, err := uuid.Parse(deviceIDStr)
if err != nil {
@@ -172,7 +172,7 @@ func (h *Handler) GetDeviceFileAliases(c echo.Context) error {
}
// BulkLinkBooks handles POST /api/sync/bulk-link-books
func (h *Handler) BulkLinkBooks(c echo.Context) error {
func (h *Handler) BulkLinkBooks(c *echo.Context) error {
ctx := c.Request().Context()
var req BulkLinkBooksRequest
@@ -250,7 +250,7 @@ func (h *Handler) BulkLinkBooks(c echo.Context) error {
}
// AutoLinkBooks handles POST /api/sync/auto-link-books
func (h *Handler) AutoLinkBooks(c echo.Context) error {
func (h *Handler) AutoLinkBooks(c *echo.Context) error {
ctx := c.Request().Context()
matchingService := h.getMatchingService()
@@ -326,7 +326,7 @@ func (h *Handler) AutoLinkBooks(c echo.Context) error {
}
// GetUnlinkedBookSuggestions handles GET /api/sync/unlinked-books/:id/suggestions
func (h *Handler) GetUnlinkedBookSuggestions(c echo.Context) error {
func (h *Handler) GetUnlinkedBookSuggestions(c *echo.Context) error {
ctx := c.Request().Context()
matchingService := h.getMatchingService()
@@ -366,7 +366,7 @@ func (h *Handler) GetUnlinkedBookSuggestions(c echo.Context) error {
}
// CreateDeviceFileAlias handles POST /api/devices/:id/file-aliases
func (h *Handler) CreateDeviceFileAlias(c echo.Context) error {
func (h *Handler) CreateDeviceFileAlias(c *echo.Context) error {
deviceIDStr := c.Param("id")
deviceID, err := uuid.Parse(deviceIDStr)
if err != nil {
@@ -421,7 +421,7 @@ func (h *Handler) CreateDeviceFileAlias(c echo.Context) error {
}
// UpdateDeviceFileAlias handles PUT /api/devices/:id/file-aliases/:aliasId
func (h *Handler) UpdateDeviceFileAlias(c echo.Context) error {
func (h *Handler) UpdateDeviceFileAlias(c *echo.Context) error {
aliasIDStr := c.Param("aliasId")
aliasID, err := uuid.Parse(aliasIDStr)
if err != nil {
@@ -488,7 +488,7 @@ func (h *Handler) UpdateDeviceFileAlias(c echo.Context) error {
}
// DeleteDeviceFileAlias handles DELETE /api/devices/:id/file-aliases/:aliasId
func (h *Handler) DeleteDeviceFileAlias(c echo.Context) error {
func (h *Handler) DeleteDeviceFileAlias(c *echo.Context) error {
aliasIDStr := c.Param("aliasId")
aliasID, err := uuid.Parse(aliasIDStr)
if err != nil {
@@ -510,7 +510,7 @@ func (h *Handler) DeleteDeviceFileAlias(c echo.Context) error {
}
// GetBookMatches handles GET /api/books/match
func (h *Handler) GetBookMatches(c echo.Context) error {
func (h *Handler) GetBookMatches(c *echo.Context) error {
matchingService := h.getMatchingService()
// Get query parameters