Files
bookhoard/internal/router/scanner.go
T
john-okeefe 46a03ebfda refactor(router): organize scanner routes into dedicated file
Phase 4 of code organization plan

Changes:
- Create internal/router/scanner.go with registerScannerRoutes()
- Move scanner route registration from handlers to router package
- Update internal/router/router.go to call registerScannerRoutes
- Remove inline scanner routes from internal/handlers/ebook.go

Scanner routes now centralized in router/scanner.go:
- POST /scanner/scan - Scan ebooks
- POST /scanner/start - Start scanner
- POST /scanner/stop - Stop scanner
- GET /scanner/status/:jobId - Get scan status
- POST /scanner/watch/start - Start watch mode
- POST /scanner/watch/stop - Stop watch mode
- GET /scanner/watch/status - Get watch mode status

This improves code organization by separating route registration
from handler logic, making the codebase easier to maintain and
follows the established pattern of organizing routes by feature.
2026-02-07 17:08:00 -05:00

21 lines
645 B
Go

package router
import (
"bookhoard/internal/handlers"
"github.com/labstack/echo/v4"
)
// registerScannerRoutes registers all scanner-related endpoints
func registerScannerRoutes(admin *echo.Group, h *handlers.Handler) {
// Scanner routes (admin only)
admin.POST("/scanner/scan", h.ScanEbooks)
admin.POST("/scanner/start", h.StartScanner)
admin.POST("/scanner/stop", h.StopScanner)
admin.GET("/scanner/status/:jobId", h.GetScanStatus)
// Watch mode routes (admin only)
admin.POST("/scanner/watch/start", h.StartWatchMode)
admin.POST("/scanner/watch/stop", h.StopWatchMode)
admin.GET("/scanner/watch/status", h.GetWatchModeStatus)
}