refactor(api): rename ScanEbooks to ScanLibrary for clarity
- Rename ScanEbooks method to ScanLibrary to reflect generic media scanning - Rename ScanEbooksRequest to ScanLibraryRequest - Update route handlers in scanner.go and library.go - Rename scan_ebooks.md to scan_library.md - No breaking changes: API endpoint remains POST /api/scanner/scan
This commit is contained in:
@@ -69,15 +69,15 @@ func SetupRoutes(g *echo.Group, db *database.Queries, connManager *wsync.Connect
|
||||
return NewHandler(db, connManager)
|
||||
}
|
||||
|
||||
// ScanEbooksRequest represents the request for scanning ebooks
|
||||
type ScanEbooksRequest struct {
|
||||
// ScanLibraryRequest represents the request for scanning a library
|
||||
type ScanLibraryRequest struct {
|
||||
FolderPaths []string `json:"folder_paths,omitempty"`
|
||||
LibraryID string `json:"library_id,omitempty"`
|
||||
}
|
||||
|
||||
// ScanEbooks handles POST /api/scanner/scan (now runs in background)
|
||||
func (h *Handler) ScanEbooks(c echo.Context) error {
|
||||
var req ScanEbooksRequest
|
||||
// ScanLibrary handles POST /api/scanner/scan (now runs in background)
|
||||
func (h *Handler) ScanLibrary(c echo.Context) error {
|
||||
var req ScanLibraryRequest
|
||||
|
||||
// Check if scan_request is set in context (from library scan route)
|
||||
if scanReq, ok := c.Get("scan_request").(map[string]interface{}); ok {
|
||||
@@ -160,7 +160,7 @@ func (h *Handler) StartScanner(c echo.Context) error {
|
||||
h.mu.Lock()
|
||||
defer h.mu.Unlock()
|
||||
|
||||
var req ScanEbooksRequest
|
||||
var req ScanLibraryRequest
|
||||
if err := c.Bind(&req); err != nil {
|
||||
return c.JSON(http.StatusBadRequest, map[string]string{"error": "invalid request"})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user