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
+9 -9
View File
@@ -11,7 +11,7 @@ import (
"github.com/google/uuid"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgtype"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v5"
)
type ConflictHandler struct {
@@ -64,7 +64,7 @@ type ConflictResolveResponse struct {
DevicesSynced []string `json:"devices_synced"`
}
func (h *ConflictHandler) GetConflictsData(c echo.Context) ([]ConflictDetailResponse, int, int, error) {
func (h *ConflictHandler) GetConflictsData(c *echo.Context) ([]ConflictDetailResponse, int, int, error) {
user := c.Get("user").(database.Users)
status := c.QueryParam("status")
@@ -126,7 +126,7 @@ func (h *ConflictHandler) GetConflictsData(c echo.Context) ([]ConflictDetailResp
return response, len(response), unresolvedCount, nil
}
func (h *ConflictHandler) ListConflicts(c echo.Context) error {
func (h *ConflictHandler) ListConflicts(c *echo.Context) error {
conflicts, total, unresolved, err := h.GetConflictsData(c)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "failed to list conflicts")
@@ -139,7 +139,7 @@ func (h *ConflictHandler) ListConflicts(c echo.Context) error {
})
}
func (h *ConflictHandler) GetConflict(c echo.Context) error {
func (h *ConflictHandler) GetConflict(c *echo.Context) error {
user := c.Get("user").(database.Users)
conflictID, err := uuid.Parse(c.Param("id"))
@@ -194,7 +194,7 @@ func (h *ConflictHandler) GetConflict(c echo.Context) error {
return c.JSON(http.StatusOK, detail)
}
func (h *ConflictHandler) ResolveConflict(c echo.Context) error {
func (h *ConflictHandler) ResolveConflict(c *echo.Context) error {
user := c.Get("user").(database.Users)
conflictID, err := uuid.Parse(c.Param("id"))
@@ -365,7 +365,7 @@ func (h *ConflictHandler) notifyDevicesOfResolution(mediaItemID pgtype.UUID, dat
return synced
}
func (h *ConflictHandler) DeleteConflict(c echo.Context) error {
func (h *ConflictHandler) DeleteConflict(c *echo.Context) error {
user := c.Get("user").(database.Users)
conflictID, err := uuid.Parse(c.Param("id"))
@@ -393,7 +393,7 @@ func (h *ConflictHandler) DeleteConflict(c echo.Context) error {
return c.NoContent(http.StatusNoContent)
}
func (h *ConflictHandler) DismissAllResolved(c echo.Context) error {
func (h *ConflictHandler) DismissAllResolved(c *echo.Context) error {
user := c.Get("user").(database.Users)
conflicts, err := h.db.ListSyncConflictsByUser(context.Background(), user.ID)
@@ -435,7 +435,7 @@ type ConflictResult struct {
Winner string `json:"winner,omitempty"`
}
func (h *ConflictHandler) BulkResolveConflicts(c echo.Context) error {
func (h *ConflictHandler) BulkResolveConflicts(c *echo.Context) error {
user := c.Get("user").(database.Users)
var req BulkResolveRequest
@@ -694,7 +694,7 @@ func (h *ConflictHandler) applyResolution(mediaItemID pgtype.UUID, userID pgtype
return err
}
func (h *ConflictHandler) BulkDismissConflicts(c echo.Context) error {
func (h *ConflictHandler) BulkDismissConflicts(c *echo.Context) error {
user := c.Get("user").(database.Users)
var req struct {