docs(media-items): Work Order 3 batch 3b — management endpoints (8)

New frontmatter'd docs:
- download (ServeFile — raw bytes, family-lens enforced; corrects the old
  download doc's claim that no download route is registered: ServeFile IS
  routed, DownloadBook is the dead code)
- set_audio_speed (speed range 0.25-4.0, NaN/Inf rejected)
- rescan (abridged example over the full 70+-column row; write-after-success
  guarantee noted)
- purge-archived (destructive, admin), unarchive (204), merge (SHA-256
  precondition, per-user collisions keep active copy)
- facets (two modes: facet+values, field autocomplete counts)
- filter_count (family lens)

Registry: RawMessage pins for map/abridged responses; Schema{} for non-JSON
body routes (download = raw bytes; unarchive = 204). Audit now:
missing docs down to ~55 (from 112), 0 orphans.
This commit is contained in:
John O'Keefe committed 2026-10-24 15:06:23 -04:00
1 parent ed0ce5d077
commit 4a6fb033cb
9 files changed
+307

No files matched your search

@@ -0,0 +1,40 @@
---
method: POST
path: /api/media-items/:id/merge
auth: jwt+admin
area: media-items
---
<!-- source: internal/handlers/media.go:1674 MediaHandler.MergeArchivedMediaItem -->
# Merge Archived Media Item
**Admin only.** Merges an archived/missing item's reading data (progress,
annotations, highlights, notes, bookmarks, ratings, collections, Kobo
shelves) into an active item with identical content (same SHA-256), then
deletes the archived row. Covers the copy-then-delete-later workflow. Per-user
collisions keep the active copy's data (mirrors hash-conflict resolution).
## Example request
```json example-request
{
"target_id": "550e8400-e29b-41d4-a716-446655440000"
}
```
## Example response
```json example-response
{
"message": "Merged reading progress, annotations, and collections into the active item"
}
```
## Errors
| Status | Body | When |
| ------ | ---- | ---- |
| 400 | `{"error": "source item is not archived or missing"}` / `{"error": "target item is not active"}` / `{"error": "items do not share the same content hash"}` | precondition violations |
| 403 | `{"error": "admin access required"}` | not an admin |
| 404 | `{"error": "archived item not found"}` / `{"error": "target item not found"}` | missing rows |
| 500 | `{"error": "failed to merge reading data: ..."}` | unexpected server error |