Files
bookhoard/bruno/dashboard/get-dashboard-sections.yml
T
john-okeefe 190914c004 test(dashboard): implement Phase 5 Bruno API tests for Carousel-style dashboard
Update and create Bruno API tests to reflect new unified collections architecture:

Updated Tests:
1. get-dashboard-sections.yml
   - Updated response structure documentation
   - Changed from type field to is_system boolean
   - Changed from id to media_item_id in items
   - Added priority field documentation
   - Updated example response to show unified collections structure
   - Added test for sections array in response

2. update-preferences.yml
   - Changed HTTP method from POST to PUT (matching handler implementation)
   - Updated request body field names:
     * hidden_sections → hidden_collections
     * section_order → collection_order
   - Updated documentation with new field names
   - Updated example request with valid system collection names

New Tests:
3. restore-system-collection.yml
   - Tests POST /api/dashboard/restore-system-collection endpoint
   - Validates collection_name against allowed system collections
   - Tests success response with message
   - Documents valid collection names:
     * continue-reading
     * recently-added
     * recently-read
     * not-started

Test Coverage:
- GET /api/dashboard/sections: Returns all dashboard sections
- PUT /api/dashboard/preferences: Updates user preferences
- POST /api/dashboard/restore-system-collection: Resets system collection

All tests follow Bruno YAML format with proper authentication via auth: inherit.
2026-02-19 21:02:47 -05:00

74 lines
2.0 KiB
YAML

info:
name: Get Dashboard Sections
type: http
seq: 1
http:
method: GET
url: '{{base_url}}/api/dashboard/sections?library_id={{library_id}}'
auth: inherit
body:
type: none
runtime:
scripts:
- type: tests
code: "test(\"status must be 200 with auth\", function() {\n expect(res.status).to.eql(200);\n\
});\n\ntest(\"response contains sections array\", function() {\n expect(res.body.sections).to.exist;\n\
expect(res.body.sections).to.be.an('array');\n });"
docs: |-
Get all dashboard sections for a specific library.
**Endpoint**: GET /api/dashboard/sections
**Auth**: Required (Bearer token via auth: inherit)
## Query Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| library_id | string | Yes | Library UUID |
| limit | int | No | Items per section (default: 20, max: 100) |
## Response
Returns array of sections including:
- System collections (continue-reading, recently-added, recently-read, not-started)
- User collections marked with show_on_dashboard: true
## Section Structure
Each section has:
- `id`: Collection name (string)
- `is_system`: Boolean indicating if this is a system collection
- `title`: Display title
- `description`: Collection description
- `icon`: Emoji icon
- `items`: Array of BookInfo objects
- `view_all_url`: URL to view all items (system collections only)
- `priority`: Display order (lower numbers first)
## Example Response
```json
{
"sections": [
{
"id": "continue-reading",
"is_system": true,
"title": "Continue Reading",
"description": "Books you're currently reading (0 < progress < 1)",
"icon": "📖",
"items": [
{
"media_item_id": "uuid",
"title": "Book Title",
"author": "Author Name",
"cover_image_path": "/path/to/cover.jpg"
}
],
"view_all_url": "/section/continue-reading",
"priority": 1
}
]
}
```