docs: update plan to reflect Handler moved to commonhandlers.go

This commit is contained in:
2026-02-27 10:30:09 -05:00
parent 4a9673b619
commit 7885d22be4
+5 -3
View File
@@ -654,7 +654,7 @@ func (h *CollectionHandler) resolveFileURL(libraryID pgtype.UUID, filePath pgtyp
**File**: `internal/handlers/progress.go`
First, add helper methods to Handler struct (defined in `scanner.go`, used by progress.go):
First, add helper methods to Handler struct (defined in `commonhandlers.go`, used by progress.go):
```go
// resolveCoverURL resolves a relative cover path to a full URL
@@ -784,7 +784,7 @@ The backend now returns full URLs like `/uploads/library-{id}/path/to/cover.jpg`
|------|---------|
| `internal/handlers/media.go` | Add `ResolveCoverURL()`, `ResolveFileURL()`, `resolveMediaURL()` helpers |
| `internal/handlers/collections.go` | Add `libraryService` to struct and constructor; add `resolveCoverURL()`, `resolveFileURL()` helpers; update lines ~199, ~626, ~935 |
| `internal/handlers/progress.go` | Add `resolveCoverURL()` to Handler (in scanner.go); update lines ~288, ~359 |
| `internal/handlers/progress.go` | Add `resolveCoverURL()` to Handler (in commonhandlers.go); update lines ~288, ~359 |
| `internal/handlers/media.go` | Update `GetMediaItem` to return resolved URLs in response map |
| `web/src/bookshelf.ts` | Remove `/covers/` prefix from cover image URL |
@@ -1072,6 +1072,8 @@ Update existing documentation to note:
| Phase | File | Change |
|-------|------|--------|
| Refactor | `internal/handlers/commonhandlers.go` | Move Handler struct from scanner.go (kitchen sink handler for progress/book matching) |
| Refactor | `internal/routers/*.go` | Update NewHandler instantiation if needed |
| 1 | `internal/services/media_scanner.go` | Add `getRelativePath()` function; use for both file_path and cover_path |
| 2 | `internal/services/library_service.go` | Add `ResolveMediaPath()` function (one source of truth) |
| 3 | `internal/handlers/media.go` | Add `getFullFilePath()` helper that calls service |
@@ -1081,7 +1083,7 @@ Update existing documentation to note:
| 6 | `internal/handlers/opds.go` | Add `libraryService` to struct; update `GetCoverImage` to use service |
| 7 | `internal/handlers/collections.go` | Add `libraryService` to struct/constructor; resolve cover paths to URLs in API responses |
| 7 | `internal/router/*.go` | Update CollectionHandler instantiation to pass LibraryService |
| 7 | `internal/handlers/scanner.go` (Handler struct, used by progress.go) | Resolve cover paths to URLs in API responses |
| 7 | `internal/handlers/commonhandlers.go` (Handler struct, used by progress.go) | Resolve cover paths to URLs in API responses |
| 7 | `internal/handlers/media.go` | Resolve file paths to URLs in API responses |
| 7 | `web/src/bookshelf.ts` | Remove `/covers/` prefix (use resolved URL directly) |
| 8 | Runtime resolution | Handles both absolute (old) and relative (new) paths |