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:
1 parent
ae9588f1c6
commit
6f13dc2b63
13 files changed
+486
-34
No files matched your search
@@ -6,6 +6,7 @@ import (
|
||||
"bookhoard/internal/database"
|
||||
"bookhoard/internal/handlers"
|
||||
"bookhoard/internal/services"
|
||||
"bookhoard/internal/sync"
|
||||
)
|
||||
|
||||
// Schema pins the machine-checkable contract for one route. The drift gate
|
||||
@@ -439,4 +440,75 @@ var Schemas = map[string]Schema{
|
||||
Request: handlers.DeviceAuthStatusRequest{},
|
||||
Response: handlers.DeviceAuthStatusResponse{},
|
||||
},
|
||||
|
||||
// --- Beam batch 4: media-items core ---
|
||||
"GET /api/media-items": {
|
||||
Response: json.RawMessage(`{"data": [{}]}`),
|
||||
},
|
||||
"GET /api/media-items/:id": {
|
||||
// Hand-built ~44-key map — pinned verbatim from the handler.
|
||||
Response: json.RawMessage(`{
|
||||
"id": "", "library_id": "", "title": "", "subtitle": "",
|
||||
"author": "", "authors": [], "isbn": "", "description": "",
|
||||
"file_path": "", "file_size": 0, "mime_type": "",
|
||||
"cover_image_path": "", "series": "", "series_number": 0,
|
||||
"tags": [], "asin": "", "date_published": "", "publisher": "",
|
||||
"publishers": [], "explicit": false, "contributors": [],
|
||||
"language": "", "edition": "", "page_count": 0, "genre": "",
|
||||
"created_at": "", "updated_at": "", "format_group": "",
|
||||
"format_mimetype": "", "narrators": [], "abridged": false,
|
||||
"manga_type": "", "reading_direction": "", "series_count": 0,
|
||||
"volume": 0, "imprint": "", "age_rating": "", "web_url": "",
|
||||
"metadata_notes": "", "community_rating": 0, "story_arc": "",
|
||||
"is_black_and_white": false, "alternate_info": "",
|
||||
"scan_information": "", "summary": "", "library_type_name": ""
|
||||
}`),
|
||||
},
|
||||
"POST /api/media-items": {
|
||||
Request: handlers.CreateMediaItemRequest{},
|
||||
Response: database.MediaItems{},
|
||||
},
|
||||
"PUT /api/media-items/:id": {
|
||||
Request: handlers.UpdateMediaItemRequest{},
|
||||
Response: database.MediaItems{},
|
||||
},
|
||||
"DELETE /api/media-items/:id": {},
|
||||
"GET /api/media-items/search": {
|
||||
Response: []database.SearchMediaItemsRow{},
|
||||
},
|
||||
"POST /api/media-items/:id/rating": {
|
||||
// NOTE: rating scale is 1-10 int (odd = half-star).
|
||||
Request: json.RawMessage(`{"rating": 0}`),
|
||||
Response: database.MediaRatings{},
|
||||
},
|
||||
"PUT /api/media-items/:id/rating": {
|
||||
Request: json.RawMessage(`{"rating": 0}`),
|
||||
Response: database.MediaRatings{},
|
||||
},
|
||||
"GET /api/media-items/:id/rating": {
|
||||
Response: database.MediaRatings{}, // absent -> {"rating": null}
|
||||
},
|
||||
"DELETE /api/media-items/:id/rating": {
|
||||
Response: json.RawMessage(`{"message": ""}`),
|
||||
},
|
||||
"GET /api/media-items/:id/progress": {
|
||||
Response: json.RawMessage(`{
|
||||
"id": null, "media_item_id": null, "user_id": null,
|
||||
"current_page": 0, "total_pages": null, "last_read_at": null,
|
||||
"percentage": null, "character_offset": null, "epubcfi": null,
|
||||
"chapter": null, "chapter_progress": null, "format_group": null,
|
||||
"total_characters": null, "chapter_count": null,
|
||||
"last_sync_device": null, "last_sync_source": null,
|
||||
"last_sync_timestamp": null, "audio_offset_seconds": null,
|
||||
"reading_mode": null, "viewport_x": null, "viewport_y": null,
|
||||
"zoom_level": null, "scroll_position_x": null,
|
||||
"scroll_position_y": null, "panel_number": null,
|
||||
"css_selector": null, "anchor_href": null,
|
||||
"char_offset": null, "context_text": null
|
||||
}`),
|
||||
},
|
||||
"PUT /api/media-items/:id/progress": {
|
||||
Request: sync.SaveProgressRequest{},
|
||||
Response: database.ReadingProgress{},
|
||||
},
|
||||
}
|
||||
Reference in new issue
Block a user