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:
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/echo/v5"
|
||||
)
|
||||
|
||||
// MatchingHandler handles book matching, linking, and file alias operations
|
||||
@@ -33,7 +33,7 @@ func (mh *MatchingHandler) getMatchingService() *services.BookMatchingService {
|
||||
}
|
||||
|
||||
// QueryBooks handles POST /api/sync/books/query
|
||||
func (mh *MatchingHandler) QueryBooks(c echo.Context) error {
|
||||
func (mh *MatchingHandler) QueryBooks(c *echo.Context) error {
|
||||
matchingService := mh.getMatchingService()
|
||||
|
||||
var req services.BookQueryRequest
|
||||
@@ -54,7 +54,7 @@ func (mh *MatchingHandler) QueryBooks(c echo.Context) error {
|
||||
}
|
||||
|
||||
// LinkBook handles POST /api/devices/:deviceId/sync/link-book
|
||||
func (mh *MatchingHandler) LinkBook(c echo.Context) error {
|
||||
func (mh *MatchingHandler) LinkBook(c *echo.Context) error {
|
||||
matchingService := mh.getMatchingService()
|
||||
|
||||
var req services.LinkBookRequest
|
||||
@@ -93,7 +93,7 @@ func (mh *MatchingHandler) LinkBook(c echo.Context) error {
|
||||
}
|
||||
|
||||
// GetUnlinkedBooks handles GET /api/devices/:deviceId/sync/unlinked-books
|
||||
func (mh *MatchingHandler) GetUnlinkedBooks(c echo.Context) error {
|
||||
func (mh *MatchingHandler) GetUnlinkedBooks(c *echo.Context) error {
|
||||
matchingService := mh.getMatchingService()
|
||||
|
||||
deviceIDStr := c.Param("deviceId")
|
||||
@@ -118,7 +118,7 @@ func (mh *MatchingHandler) GetUnlinkedBooks(c echo.Context) error {
|
||||
}
|
||||
|
||||
// GetDeviceFileAliases handles GET /api/devices/:id/file-aliases
|
||||
func (mh *MatchingHandler) GetDeviceFileAliases(c echo.Context) error {
|
||||
func (mh *MatchingHandler) GetDeviceFileAliases(c *echo.Context) error {
|
||||
deviceIDStr := c.Param("id")
|
||||
deviceID, err := uuid.Parse(deviceIDStr)
|
||||
if err != nil {
|
||||
@@ -163,7 +163,7 @@ func (mh *MatchingHandler) GetDeviceFileAliases(c echo.Context) error {
|
||||
}
|
||||
|
||||
// CreateDeviceFileAlias handles POST /api/devices/:id/file-aliases
|
||||
func (mh *MatchingHandler) CreateDeviceFileAlias(c echo.Context) error {
|
||||
func (mh *MatchingHandler) CreateDeviceFileAlias(c *echo.Context) error {
|
||||
deviceIDStr := c.Param("id")
|
||||
deviceID, err := uuid.Parse(deviceIDStr)
|
||||
if err != nil {
|
||||
@@ -218,7 +218,7 @@ func (mh *MatchingHandler) CreateDeviceFileAlias(c echo.Context) error {
|
||||
}
|
||||
|
||||
// UpdateDeviceFileAlias handles PUT /api/devices/:id/file-aliases/:aliasId
|
||||
func (mh *MatchingHandler) UpdateDeviceFileAlias(c echo.Context) error {
|
||||
func (mh *MatchingHandler) UpdateDeviceFileAlias(c *echo.Context) error {
|
||||
aliasIDStr := c.Param("aliasId")
|
||||
aliasID, err := uuid.Parse(aliasIDStr)
|
||||
if err != nil {
|
||||
@@ -284,7 +284,7 @@ func (mh *MatchingHandler) UpdateDeviceFileAlias(c echo.Context) error {
|
||||
}
|
||||
|
||||
// DeleteDeviceFileAlias handles DELETE /api/devices/:id/file-aliases/:aliasId
|
||||
func (mh *MatchingHandler) DeleteDeviceFileAlias(c echo.Context) error {
|
||||
func (mh *MatchingHandler) DeleteDeviceFileAlias(c *echo.Context) error {
|
||||
aliasIDStr := c.Param("aliasId")
|
||||
aliasID, err := uuid.Parse(aliasIDStr)
|
||||
if err != nil {
|
||||
@@ -306,7 +306,7 @@ func (mh *MatchingHandler) DeleteDeviceFileAlias(c echo.Context) error {
|
||||
}
|
||||
|
||||
// GetBookMatches handles GET /api/books/match
|
||||
func (mh *MatchingHandler) GetBookMatches(c echo.Context) error {
|
||||
func (mh *MatchingHandler) GetBookMatches(c *echo.Context) error {
|
||||
matchingService := mh.getMatchingService()
|
||||
|
||||
identifiers := c.QueryParams()["identifier"]
|
||||
@@ -345,7 +345,7 @@ func (mh *MatchingHandler) GetBookMatches(c echo.Context) error {
|
||||
}
|
||||
|
||||
// BulkLinkBooks handles POST /api/sync/bulk-link-books
|
||||
func (mh *MatchingHandler) BulkLinkBooks(c echo.Context) error {
|
||||
func (mh *MatchingHandler) BulkLinkBooks(c *echo.Context) error {
|
||||
ctx := c.Request().Context()
|
||||
|
||||
var req BulkLinkBooksRequest
|
||||
@@ -423,7 +423,7 @@ func (mh *MatchingHandler) BulkLinkBooks(c echo.Context) error {
|
||||
}
|
||||
|
||||
// AutoLinkBooks handles POST /api/sync/auto-link-books
|
||||
func (mh *MatchingHandler) AutoLinkBooks(c echo.Context) error {
|
||||
func (mh *MatchingHandler) AutoLinkBooks(c *echo.Context) error {
|
||||
ctx := c.Request().Context()
|
||||
matchingService := mh.getMatchingService()
|
||||
|
||||
@@ -499,7 +499,7 @@ func (mh *MatchingHandler) AutoLinkBooks(c echo.Context) error {
|
||||
}
|
||||
|
||||
// GetUnlinkedBookSuggestions handles GET /api/sync/unlinked-books/:id/suggestions
|
||||
func (mh *MatchingHandler) GetUnlinkedBookSuggestions(c echo.Context) error {
|
||||
func (mh *MatchingHandler) GetUnlinkedBookSuggestions(c *echo.Context) error {
|
||||
ctx := c.Request().Context()
|
||||
matchingService := mh.getMatchingService()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user