docs(libraries): Work Order 3 batch 2 — 10 missing endpoints + array-response gate support
New frontmatter'd docs with handler-compatible shapes:
- get_library_types.md (public; []LibraryTypes)
- list_libraries.md (admin; {data: ListLibrariesRow})
- get_library_folders.md (admin; []LibraryFolders)
- list/get stats/resolve/delete processing issues (admin; family-lens 403s
documented)
- scan_library.md (202 + 409 coalescing with active_job_id)
- get/update scan-settings (ScanSettingsResponse)
Gate improvements forced by this batch:
- Array responses: registered slice -> doc example must be a JSON array; key
set compared against the element type
- RawMessage pins may now be arrays
- update scan-settings uses a RawMessage pin: handler always sets Message but
the struct's omitempty would reject correct docs via zero-value marshal
Registry: sqlc models pinned directly (LibraryTypes, LibraryFolders,
ListLibrariesRow — json tags verified in the generated code).
This commit is contained in:
1 parent
c4b62af213
commit
85cdaf7196
12 files changed
+423
-11
No files matched your search
+47
-3
@@ -3,6 +3,7 @@ package docs
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"bookhoard/internal/database"
|
||||
"bookhoard/internal/handlers"
|
||||
"bookhoard/internal/services"
|
||||
)
|
||||
@@ -89,9 +90,9 @@ var Schemas = map[string]Schema{
|
||||
},
|
||||
"GET /api/devices/:id/collections": {
|
||||
Response: struct {
|
||||
DeviceID string `json:"device_id"`
|
||||
Mappings []handlers.DeviceMappingSummary `json:"mappings"`
|
||||
Total int `json:"total"`
|
||||
DeviceID string `json:"device_id"`
|
||||
Mappings []handlers.DeviceMappingSummary `json:"mappings"`
|
||||
Total int `json:"total"`
|
||||
}{},
|
||||
},
|
||||
"PUT /api/devices/:id/collections/:collectionId": {
|
||||
@@ -119,4 +120,47 @@ var Schemas = map[string]Schema{
|
||||
}
|
||||
}`),
|
||||
},
|
||||
|
||||
// --- libraries (batch 2) ---
|
||||
"GET /api/libraries/types": {
|
||||
Response: []database.LibraryTypes{},
|
||||
},
|
||||
"GET /api/libraries": {
|
||||
Response: struct {
|
||||
Data []database.ListLibrariesRow `json:"data"`
|
||||
}{},
|
||||
},
|
||||
"GET /api/libraries/:id/folders": {
|
||||
Response: []database.LibraryFolders{},
|
||||
},
|
||||
"GET /api/libraries/:id/issues/list": {
|
||||
Response: []handlers.ProcessingIssueResponse{},
|
||||
},
|
||||
"GET /api/libraries/:id/issues/stats": {
|
||||
Response: handlers.ProcessingIssueStats{},
|
||||
},
|
||||
"POST /api/libraries/:id/issues/:issueId/:mediaItemId/resolve": {
|
||||
Response: json.RawMessage(`{"success": false, "message": ""}`),
|
||||
},
|
||||
"DELETE /api/libraries/:id/issues/:issueId": {
|
||||
Response: json.RawMessage(`{"success": false, "message": ""}`),
|
||||
},
|
||||
"POST /api/libraries/:id/scan": {
|
||||
Request: nil, // library_id injected from the path; no body used
|
||||
Response: json.RawMessage(`{"message": "", "job_id": "", "status": ""}`),
|
||||
},
|
||||
"GET /api/libraries/scan-settings": {
|
||||
Response: handlers.ScanSettingsResponse{},
|
||||
},
|
||||
"PUT /api/libraries/scan-settings": {
|
||||
Request: handlers.UpdateScanSettingsRequest{},
|
||||
// RawMessage pin (not the struct): the update handler ALWAYS sets
|
||||
// Message, but the struct's omitempty would drop it from a
|
||||
// zero-value marshal and the gate would reject correct docs.
|
||||
Response: json.RawMessage(`{
|
||||
"scan_poll_interval_seconds": 0,
|
||||
"auto_scan_enabled": false,
|
||||
"message": ""
|
||||
}`),
|
||||
},
|
||||
}
|
||||
Reference in new issue
Block a user