diff --git a/bruno/dashboard/get-dashboard-sections.yml b/bruno/dashboard/get-dashboard-sections.yml index 3f3382d..e79ef6e 100644 --- a/bruno/dashboard/get-dashboard-sections.yml +++ b/bruno/dashboard/get-dashboard-sections.yml @@ -4,49 +4,70 @@ info: seq: 1 http: method: GET - url: '{{base_url}}/api/dashboard/sections' + 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);" + 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 | - - ## Response - - Returns array of sections including: - - Smart sections (continue-reading, in-progress, recently-added, etc.) - - User collections marked with show_on_dashboard: true - - ## Section Types - - | Type | Description | - |------|-------------| - | smart | Auto-generated sections based on user activity | - | collection | User-created collections with dashboard enabled | - - ## Example Response - - ```json - { - "sections": [ - { - "id": "continue-reading", - "type": "smart", - "title": "Continue Reading", - "icon": "📖", - "items": [...], - "view_all_url": "/section/continue-reading" + + **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 + } + ] + } + ``` diff --git a/bruno/dashboard/restore-system-collection.yml b/bruno/dashboard/restore-system-collection.yml new file mode 100644 index 0000000..7d6f73c --- /dev/null +++ b/bruno/dashboard/restore-system-collection.yml @@ -0,0 +1,47 @@ +info: + name: Restore System Collection + type: http + seq: 3 +http: + method: POST + url: '{{base_url}}/api/dashboard/restore-system-collection' + auth: inherit + body: + type: json + jsonBody: "{\n \"collection_name\": \"continue-reading\"\n}" +runtime: + scripts: + - type: tests + code: "test(\"status must be 200 with valid collection\", function() {\n expect(res.status).to.eql(200);\n\ + });\n\ntest(\"response has success message\", function() {\n expect(res.body.message).to.exist;\n\ + });" + +docs: |- + Restore a system collection to its default state. + + **Endpoint**: POST /api/dashboard/restore-system-collection + **Auth**: Required (Bearer token) + + ## Request Body + + | Field | Type | Required | Description | + |-------|------|----------|-------------| + | collection_name | string | Yes | Name of system collection to restore | + + Valid collection names: + - `continue-reading`: Books you're currently reading (0 < progress < 1) + - `recently-added`: Newly added items to this library + - `recently-read`: Books you've finished (progress >= 1) + - `not-started`: Books you haven't read yet (progress = 0 or no record) + + ## Example Request + + ```json + { + "collection_name": "continue-reading" + } + ``` + + ## Response + + Returns success message on restore. diff --git a/bruno/dashboard/update-preferences.yml b/bruno/dashboard/update-preferences.yml index d8913ca..2c892ba 100644 --- a/bruno/dashboard/update-preferences.yml +++ b/bruno/dashboard/update-preferences.yml @@ -3,34 +3,46 @@ info: type: http seq: 2 http: - method: POST + method: PUT url: '{{base_url}}/api/dashboard/preferences' auth: inherit + body: + type: json + jsonBody: "{\n \"library_id\": \"{{library_id}}\",\n \"hidden_collections\"\ + : [\"not-started\"],\n \"collection_order\": [\"recently-added\", \"continue-reading\"\ + , \"recently-read\"],\n \"items_per_section\": 20\n}" runtime: scripts: - type: tests - code: "test(\"status must be 200 with valid request\", function() {\n expect(res.status).to.eql(200);" + code: "test(\"status must be 200 with valid request\", function() {\n expect(res.status).to.eql(200);\n\ + });" docs: |- Update dashboard preferences for the authenticated user. - - **Endpoint**: POST /api/dashboard/preferences - **Auth**: Required (Bearer token) - - ## Request Body - - | Field | Type | Required | Description | - |-------|------|----------|-------------| - | library_id | string | Yes | Library UUID | - | hidden_sections | array | No | Section IDs to hide | - | section_order | array | No | Section IDs in custom order | - | items_per_section | int | No | Items to show per section (10-50) | - - ## Example Request - - ```json - { - "library_id": "cc23c3a7-f8fb-451a-a78d-2a16df1b725a", - "hidden_sections": ["recently-added"], - "section_order": ["continue-reading", "in-progress"], - "items_per_section": 25 + + **Endpoint**: PUT /api/dashboard/preferences + **Auth**: Required (Bearer token) + + ## Request Body + + | Field | Type | Required | Description | + |-------|------|----------|-------------| + | library_id | string | Yes | Library UUID | + | hidden_collections | array | No | Collection names to hide from dashboard | + | collection_order | array | No | Collection names in custom display order | + | items_per_section | int | No | Items to show per section (default: 20) | + + ## Example Request + + ```json + { + "library_id": "cc23c3a7-f8fb-451a-a78d-2a16df1b725a", + "hidden_collections": ["not-started"], + "collection_order": ["recently-added", "continue-reading", "recently-read"], + "items_per_section": 20 + } + ``` + + ## Response + + Returns updated preferences object on success.