refactor: update Bruno API collection for media-items system
- Remove all ebook-specific API requests (15 files deleted) - Rename Scan Ebooks.bru to Scan Media Items.bru - Update API paths from /api/ebooks to /api/media-items - Update base URL and environment configuration - Maintain all existing media-items, library, auth, and progress tests Aligns Bruno collection with unified media-items API architecture
This commit is contained in:
@@ -6,8 +6,8 @@ meta {
|
||||
|
||||
post {
|
||||
url: {{base_url}}/api/media-items/{{media_item_id}}/rating
|
||||
auth: inherit
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
@@ -20,46 +20,6 @@ body:json {
|
||||
}
|
||||
}
|
||||
|
||||
tests {
|
||||
test_create_rating_success(status, headers, body) {
|
||||
if (status !== 201) {
|
||||
throw new Error("Expected status 201, got " + status);
|
||||
}
|
||||
|
||||
const contentType = headers["content-type"];
|
||||
if (!contentType || !contentType.includes("application/json")) {
|
||||
throw new Error("Expected content-type to contain application/json, got " + contentType);
|
||||
}
|
||||
|
||||
// Verify response body is valid JSON and has expected structure
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(body);
|
||||
} catch (e) {
|
||||
throw new Error("Response body is not valid JSON");
|
||||
}
|
||||
|
||||
if (!data || typeof data !== "object") {
|
||||
throw new Error("Expected response body to be an object");
|
||||
}
|
||||
|
||||
// Check for required fields in rating response
|
||||
if (!data.id) {
|
||||
throw new Error("Rating response missing required field: id");
|
||||
}
|
||||
|
||||
if (!data.media_item_id) {
|
||||
throw new Error("Rating response missing required field: media_item_id");
|
||||
}
|
||||
|
||||
if (typeof data.rating !== "number" || data.rating < 1 || data.rating > 10) {
|
||||
throw new Error("Invalid rating value: " + data.rating + " (must be 1-10)");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
vars:pre-request {
|
||||
mediaItemId: "9932c704-i29b-81d4-e716-446655440004"
|
||||
}
|
||||
@@ -91,7 +51,7 @@ docs {
|
||||
**Example Request:**
|
||||
- `"rating": 7` = 3.5 stars (frontend display)
|
||||
- `"rating": 8` = 4.0 stars (frontend display)
|
||||
|
||||
|
||||
**Response:** Rating object
|
||||
- `id` (string): Rating UUID
|
||||
- `media_item_id` (string): Media item UUID
|
||||
@@ -99,7 +59,7 @@ docs {
|
||||
- `rating` (number): Rating value (1-10)
|
||||
- `created_at` (string): Creation timestamp
|
||||
- `updated_at` (string): Last update timestamp
|
||||
|
||||
|
||||
**Status Codes:**
|
||||
- 201: Rating created successfully
|
||||
- 200: Rating updated successfully (if rating already existed)
|
||||
|
||||
Reference in New Issue
Block a user