backend: add force rescan parameter to scanner

- Add Force bool field to ScanLibraryRequest in handlers
- Pass force param through job params to worker
- Add forceRescan field and SetForce method to MediaScanner
- Modify processMediaFile to delete and re-create existing items when force=true
- Default behavior unchanged (force=false maintains skip-if-exists)
This commit is contained in:
2026-02-26 10:11:46 -05:00
parent d7526a5bf4
commit a97220e654
3 changed files with 30 additions and 6 deletions
+2
View File
@@ -89,6 +89,7 @@ func SetupRoutes(g *echo.Group, db *database.Queries, connManager *wsync.Connect
type ScanLibraryRequest struct {
FolderPaths []string `json:"folder_paths,omitempty"`
LibraryID string `json:"library_id,omitempty"`
Force bool `json:"force,omitempty"`
}
// ScanLibrary handles POST /api/scanner/scan (now runs in background)
@@ -155,6 +156,7 @@ func (h *Handler) ScanLibrary(c echo.Context) error {
"folders": folderPaths,
"admin_id": userUUID.String(),
"db": h.db,
"force": req.Force,
},
Status: services.JobStatusPending,
Context: h.ctx,