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:
2026-01-30 13:52:06 -05:00
parent dc820dfb92
commit ba31e1491e
33 changed files with 81 additions and 1290 deletions
+3 -43
View File
@@ -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)
+9 -71
View File
@@ -6,6 +6,7 @@ meta {
get {
url: {{base_url}}/api/media-items/filtered?library_id={{library_id}}&genre_filter=Fiction&language_filter=en&year_min=2000&year_max=2024&limit=10&offset=0
body: none
auth: inherit
}
@@ -13,69 +14,6 @@ headers {
Content-Type: application/json
}
tests {
test_filter_media_items(status, headers, body) {
if (status !== 200) {
throw new Error("Expected status 200, 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);
}
let data;
try {
const parsed = JSON.parse(body);
data = parsed.data;
} catch (e) {
throw new Error("Response body is not valid JSON: " + e.message);
}
if (!Array.isArray(data)) {
throw new Error("Expected response data to be an array");
}
// Verify filters are applied
data.forEach((item, index) => {
if (!item || typeof item !== "object") {
throw new Error("Media item at index " + index + " is not an object");
}
if (!item.id) {
throw new Error("Media item at index " + index + " missing required field: id");
}
if (!item.title) {
throw new Error("Media item at index " + index + " missing required field: title");
}
if (!item.library_id) {
throw new Error("Media item at index " + index + " missing required field: library_id");
}
// Check genre filter if genre is specified
if (item.genre && item.genre !== 'Fiction') {
throw new Error("Item at index " + index + " has incorrect genre: " + item.genre);
}
// Check language filter if language is specified
if (item.language && item.language !== 'en') {
throw new Error("Item at index " + index + " has incorrect language: " + item.language);
}
// Check year range if specified
if (item.copyright_year) {
if (item.copyright_year < 2000 || item.copyright_year > 2024) {
throw new Error("Item at index " + index + " has copyright_year outside range: " + item.copyright_year);
}
}
});
return true;
}
}
vars:pre-request {
genre: "Fiction"
language: "en"
@@ -90,13 +28,13 @@ settings {
docs {
## Filter Media Items
**Method:** GET
**Endpoint:** /api/media-items/filtered
**Authentication:** Required (Bearer token)
**Query Parameters:**
- `library_id` (string, required): UUID of the library
- `author_filter` (string, optional): Filter by author (partial match)
@@ -109,22 +47,22 @@ docs {
- `sort` (string, optional): Sort field and direction (same options as ListMediaItems)
- `limit` (integer, optional): Number of items to return (default: 50, max: 1000)
- `offset` (integer, optional): Number of items to skip (default: 0)
**Response:** Object containing array of filtered media items
**Status Codes:**
- 200: Success
- 400: Bad request (invalid parameters)
- 401: Unauthorized
- 500: Internal server error
**Examples:**
- Filter by genre: `/api/media-items/filtered?library_id=xxx&genre_filter=Fiction`
- Filter by language: `/api/media-items/filtered?library_id=xxx&language_filter=es`
- Filter by year range: `/api/media-items/filtered?library_id=xxx&year_min=2000&year_max=2024`
- Filter by cover: `/api/media-items/filtered?library_id=xxx&has_cover=true`
- Combine filters: `/api/media-items/filtered?library_id=xxx&genre_filter=Sci-Fi&year_min=2010&language_filter=en`
**Filter Behavior:**
- Multiple filters can be combined (AND logic)
- Author and series filters use partial matching (ILIKE)
+9 -66
View File
@@ -6,6 +6,7 @@ meta {
get {
url: {{base_url}}/api/media-items?library_id={{library_id}}&sort=title+ASC&limit=10&offset=0
body: none
auth: inherit
}
@@ -13,64 +14,6 @@ headers {
Content-Type: application/json
}
tests {
test_list_media_items_sorted(status, headers, body) {
if (status !== 200) {
throw new Error("Expected status 200, 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);
}
let data;
try {
const parsed = JSON.parse(body);
data = parsed.data;
} catch (e) {
throw new Error("Response body is not valid JSON: " + e.message);
}
if (!Array.isArray(data)) {
throw new Error("Expected response data to be an array");
}
// Verify items are sorted by title ascending
for (let i = 1; i < data.length; i++) {
const prevTitle = data[i - 1].title.toLowerCase();
const currTitle = data[i].title.toLowerCase();
if (prevTitle > currTitle) {
throw new Error("Items not sorted by title ASC: " + prevTitle + " should come before " + currTitle);
}
}
data.forEach((item, index) => {
if (!item || typeof item !== "object") {
throw new Error("Media item at index " + index + " is not an object");
}
if (!item.id) {
throw new Error("Media item at index " + index + " missing required field: id");
}
if (!item.title) {
throw new Error("Media item at index " + index + " missing required field: title");
}
if (!item.library_id) {
throw new Error("Media item at index " + index + " missing required field: library_id");
}
if (!item.library_name) {
throw new Error("Media item at index " + index + " missing required field: library_name");
}
});
return true;
}
}
vars:pre-request {
sortBy: "title ASC"
}
@@ -82,13 +25,13 @@ settings {
docs {
## List Media Items with Sorting
**Method:** GET
**Endpoint:** /api/media-items
**Authentication:** Required (Bearer token)
**Query Parameters:**
- `library_id` (string, required): UUID of the library
- `sort` (string, optional): Sort field and direction
@@ -111,20 +54,20 @@ docs {
- `genre DESC` - Genre Z-A
- `limit` (integer, optional): Number of items to return (default: 50, max: 1000)
- `offset` (integer, optional): Number of items to skip (default: 0)
**Response:** Object containing array of media items
**Status Codes:**
- 200: Success
- 400: Bad request (invalid parameters)
- 401: Unauthorized
- 500: Internal server error
**Examples:**
- Sort by title: `/api/media-items?library_id=xxx&sort=title+ASC`
- Sort by author descending: `/api/media-items?library_id=xxx&sort=author+DESC`
- Sort by page count: `/api/media-items?library_id=xxx&sort=page_count+ASC`
**Sorting Behavior:**
- All sorts are secondary-sorted by series_number then title for consistency
- NULL values are sorted last for ascending, first for descending