docs(media-items): Work Order 3 batch 3a — reader-adjacent CRUD (11 endpoints)

New frontmatter'd docs with real shapes (sqlc models pinned directly):
- bookmarks: get/create/update/delete (sync-aware rows: dedup_key,
  last_modified_*, tombstones; delete is 204)
- review: upsert (empty string DELETES the review) / get (200 with
  {review:null} when absent) / delete
- get single note + highlight (full sqlc row shapes)
- annotation history: restore (POST, kind via query or body) and purge
  (DELETE, kind via required query; permanent)

Gate hardening forced by this batch:
- required-field walk now guards non-struct Request types (RawMessage pins)
- update_media_bookmark needed a full example block (no cross-reference
  shortcuts — the gate checks every doc standalone)
This commit is contained in:
John O'Keefe committed 2026-10-24 15:03:36 -04:00
1 parent 85cdaf7196
commit ed0ce5d077
13 files changed
+545 -4

No files matched your search

@@ -0,0 +1,36 @@
---
method: POST
path: /api/media-items/:id/annotations/:annotationId/restore
auth: jwt
area: media-items
---
<!-- source: internal/handlers/annotation_history.go:77 MediaHandler.RestoreDeletedAnnotation -->
# Restore Deleted Annotation
Restores a tombstoned annotation (highlight, note, or bookmark). The kind is
read from the `annotation_type` **query parameter** or, if absent, from a JSON
body `{"annotation_type": "..."}`.
## Example request
```text
POST /api/media-items/550e8400-.../annotations/440e8400-.../restore?annotation_type=highlight
```
## Example response
```json example-response
{
"restored": true
}
```
## Errors
| Status | Body | When |
| ------ | ---- | ---- |
| 400 | `{"error": "annotation_type must be highlight, note, or bookmark"}` | missing/invalid kind |
| 404 | `{"error": "deleted annotation not found"}` | nothing tombstoned under that id |
| 500 | `{"error": "failed to restore annotation"}` | unexpected server error |
| 503 | `{"error": "annotation service unavailable"}` | service not constructed |