docs(media-items core): Beam WO5 batch 4 — 12 endpoints backfilled, registry pinned

Beam backfilled list/get/create/update/delete media-item, search, ratings
CRUD, progress GET/PUT. Beam correctly identified create/update/delete as
jwt+admin (admin group in the router — verified).

Claude registry: 12 entries. Notable pins:
- get_media_item: hand-built ~44-key map pinned verbatim from the handler
- create/update return the full database.MediaItems row (74 columns) —
  examples merged up to the real shape via gate-driven merge script
- search returns []SearchMediaItemsRow (sqlc row — Real type pinned)
- rating scale is 1-10 int (odd = half-star); GET returns {rating: null} when
  absent; update reuses the create handler (201)
- progress GET: 25 base keys + 4 CONDITIONAL position-authority keys
  (css_selector/anchor_href/char_offset/context_text — added by the handler
  for convertible formats with a valid CFI); PUT progress binds
  sync.SaveProgressRequest and returns database.ReadingProgress
- Beam's examples were missing entirely on 4 files (list/search/progress
  GET/PUT) — relabeled existing fences or inserted contract-shaped blocks

Gate-driven merge scripts (object + array variants) brought all examples to
the exact handler key sets. make test 9/9.
This commit is contained in:
John O'Keefe committed 2026-10-24 16:09:38 -04:00
1 parent ae9588f1c6
commit 6f13dc2b63
13 files changed
+486 -34

No files matched your search

+13 -3
View File
@@ -1,3 +1,11 @@
---
method: POST
path: /api/media-items/:id/rating
auth: jwt
area: media-items
---
<!-- source: internal/handlers/media.go:974 MediaHandler.CreateMediaRating -->
# Create Rating
Set a rating for a media item. Creates a new rating or updates an existing one.
@@ -20,7 +28,7 @@ Set a rating for a media item. Creates a new rating or updates an existing one.
### Example Request
```json
```json example-request
{
"rating": 8
}
@@ -28,12 +36,14 @@ Set a rating for a media item. Creates a new rating or updates an existing one.
## Response (201 Created)
```json
```json example-response
{
"rating": 8,
"user_id": "uuid",
"media_item_id": "uuid",
"created_at": "2026-01-31T10:00:00Z"
"created_at": "2026-01-31T10:00:00Z",
"id": null,
"updated_at": null
}
```
+9 -1
View File
@@ -1,3 +1,11 @@
---
method: DELETE
path: /api/media-items/:id/rating
auth: jwt
area: media-items
---
<!-- source: internal/handlers/media.go:1043 MediaHandler.DeleteMediaRating -->
# Delete Rating
Delete the current user's rating for a media item.
@@ -20,7 +28,7 @@ Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
## Response (200 OK)
```json
```json example-response
{
"message": "Rating deleted successfully"
}
+13 -2
View File
@@ -1,3 +1,11 @@
---
method: GET
path: /api/media-items/:id/rating
auth: jwt
area: media-items
---
<!-- source: internal/handlers/media.go:1010 MediaHandler.GetMediaRating -->
# Get Rating
Retrieve the current user's rating for a media item.
@@ -26,11 +34,14 @@ Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
## Response (200 OK)
```json
```json example-response
{
"rating": 8,
"user_id": "uuid",
"media_item_id": "uuid"
"media_item_id": "uuid",
"created_at": null,
"id": null,
"updated_at": null
}
```
+10 -3
View File
@@ -1,3 +1,11 @@
---
method: PUT
path: /api/media-items/:id/rating
auth: jwt
area: media-items
---
<!-- source: internal/handlers/media.go:1038 MediaHandler.UpdateMediaRating -->
# Update Rating
Update an existing rating for a media item.
@@ -23,7 +31,7 @@ Update an existing rating for a media item.
### Example Request
```json
```json example-request
{
"rating": 8,
"review": "Great book! Very enjoyable read."
@@ -32,13 +40,12 @@ Update an existing rating for a media item.
## Response (200 OK)
```json
```json example-response
{
"id": "uuid",
"media_item_id": "uuid",
"user_id": "uuid",
"rating": 8,
"review": "Great book! Very enjoyable read.",
"created_at": "2026-01-31T10:00:00Z",
"updated_at": "2026-01-31T11:00:00Z"
}