refactor: Reorganize Bruno requests by role permissions
- Create separate admin folder for admin-only operations
- Move admin endpoints (Create/Update/Delete Ebook, Scanner, Folder Management) to /bruno/admin/
- Add admin dashboard, profile, and library page requests
- Add Register Admin User request with explicit admin role
- Update Register User request to include role field
- Remove empty scanner folder structure
API organization:
- Admin requests: /bruno/admin/ (require admin role)
- User requests: /bruno/user/ (available to all authenticated users)
- Environment: Single {{token}} variable works for both roles
This commit is contained in:
@@ -1,78 +0,0 @@
|
||||
meta {
|
||||
name: Create Ebook
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
post {
|
||||
url: http://localhost:8765/api/ebooks
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"title": "Sample Book",
|
||||
"author": "Sample Author",
|
||||
"isbn": "1234567890",
|
||||
"description": "A sample ebook",
|
||||
"file_path": "/uploads/sample.epub",
|
||||
"file_size": 1024000,
|
||||
"mime_type": "application/epub+zip",
|
||||
"cover_image_path": "/uploads/cover.jpg",
|
||||
"series": "Sample Series",
|
||||
"series_number": 1,
|
||||
"tags": "fiction,adventure",
|
||||
"asin": "B0123456789",
|
||||
"date_published": "2023-01-15",
|
||||
"publisher": "Sample Publisher",
|
||||
"contributors": "Editor Name, Illustrator Name"
|
||||
}
|
||||
}
|
||||
|
||||
script:post-response {
|
||||
function onResponse(res) {
|
||||
let data = res.getBody();
|
||||
let token = bru.setEnvVar("ebookid", data.id, { persist: true });
|
||||
}
|
||||
onResponse(res);
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Create Ebook
|
||||
|
||||
Creates a new ebook entry in the library. **Admin only operation.**
|
||||
|
||||
**Authentication:** Required (Bearer token + Admin role)
|
||||
|
||||
**Request Body:**
|
||||
- `title` (string, required): Book title
|
||||
- `author` (string, optional): Book author
|
||||
- `isbn` (string, optional): ISBN number
|
||||
- `description` (string, optional): Book description
|
||||
- `file_path` (string, required): Path to ebook file
|
||||
- `file_size` (number, optional): File size in bytes
|
||||
- `mime_type` (string, optional): MIME type
|
||||
- `cover_image_path` (string, optional): Path to cover image
|
||||
- `series` (string, optional): Book series name
|
||||
- `series_number` (number, optional): Position in series
|
||||
- `tags` (string, optional): Comma-separated tags
|
||||
- `asin` (string, optional): Amazon ASIN
|
||||
- `date_published` (string, optional): Publication date (YYYY-MM-DD)
|
||||
- `publisher` (string, optional): Publisher name
|
||||
- `contributors` (string, optional): Additional contributors
|
||||
|
||||
**Response:** Created ebook object (with added_by_admin_id field)
|
||||
|
||||
**Error Responses:**
|
||||
- 401: Invalid authentication
|
||||
- 403: Forbidden (non-admin users)
|
||||
- 400: Invalid request data
|
||||
|
||||
**Note:** Ebook will be automatically associated with the admin user who creates it.
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
meta {
|
||||
name: Delete Ebook
|
||||
type: http
|
||||
seq: 5
|
||||
}
|
||||
|
||||
delete {
|
||||
url: http://localhost:8765/api/ebooks/{{ebookid}}
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
script:post-response {
|
||||
function onResponse(res) {
|
||||
let token = bru.setEnvVar("ebookid", "", { persist: true });
|
||||
}
|
||||
onResponse(res);
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Delete Ebook
|
||||
|
||||
Removes an ebook from the library.
|
||||
|
||||
**Authentication:** Required (Bearer token)
|
||||
|
||||
**Path Parameters:**
|
||||
- `id` (string): Ebook UUID
|
||||
|
||||
**Response:** 204 No Content
|
||||
|
||||
**Error Responses:**
|
||||
- 401: Invalid authentication
|
||||
- 404: Ebook not found
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
meta {
|
||||
name: Update Ebook
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
put {
|
||||
url: http://localhost:8765/api/ebooks/{{ebookid}}
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"title": "Updated Book Title",
|
||||
"author": "Updated Author",
|
||||
"description": "Updated description",
|
||||
"series": "Updated Series",
|
||||
"series_number": 2,
|
||||
"tags": "fiction,drama",
|
||||
"asin": "B0987654321",
|
||||
"date_published": "2023-06-15",
|
||||
"publisher": "Updated Publisher",
|
||||
"contributors": "Updated Editor"
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Update Ebook
|
||||
|
||||
Updates an existing ebook's metadata.
|
||||
|
||||
**Authentication:** Required (Bearer token)
|
||||
|
||||
**Path Parameters:**
|
||||
- `id` (string): Ebook UUID
|
||||
|
||||
**Request Body:** (all fields optional)
|
||||
- `title` (string): Book title
|
||||
- `author` (string): Book author
|
||||
- `isbn` (string): ISBN number
|
||||
- `description` (string): Book description
|
||||
- `cover_image_path` (string): Path to cover image
|
||||
- `series` (string): Book series name
|
||||
- `series_number` (number): Position in series
|
||||
- `tags` (string): Comma-separated tags
|
||||
- `asin` (string): Amazon ASIN
|
||||
- `date_published` (string): Publication date (YYYY-MM-DD)
|
||||
- `publisher` (string): Publisher name
|
||||
- `contributors` (string): Additional contributors
|
||||
|
||||
**Response:** Updated ebook object
|
||||
|
||||
**Error Responses:**
|
||||
- 401: Invalid authentication
|
||||
- 404: Ebook not found
|
||||
- 400: Invalid request data
|
||||
}
|
||||
Reference in New Issue
Block a user