Update Bruno API tests for user endpoints including new profile management

This commit is contained in:
2026-01-23 21:27:13 -05:00
parent 382a2369c5
commit 7c70e9e85a
12 changed files with 144 additions and 81 deletions
+12 -12
View File
@@ -1,7 +1,7 @@
meta { meta {
name: Add Ebook Folder name: Add Ebook Folder
type: http type: http
seq: 5 seq: 8
} }
post { post {
@@ -10,9 +10,9 @@ post {
auth: inherit auth: inherit
} }
body { body:json {
{ {
"folder_path": "/path/to/ebooks" "folder_path": "/home/user/ebooks"
} }
} }
@@ -23,27 +23,27 @@ settings {
docs { docs {
## Add Ebook Folder ## Add Ebook Folder
Adds a new ebook folder for the authenticated user. Adds a new ebook folder for the authenticated user.
**Method:** POST **Method:** POST
**Endpoint:** /api/auth/ebook-folders **Endpoint:** /api/auth/ebook-folders
**Authentication:** Required **Authentication:** Required
**Request Body:** **Request Body:**
- `folder_path` (string, required): Path to the ebook folder - `folder_path` (string, required): Path to the ebook folder
**Response:** **Response:**
- `id` (string): Folder ID - `id` (string): Folder ID
- `user_id` (string): User ID - `user_id` (string): User ID
- `folder_path` (string): Folder path - `folder_path` (string): Folder path
- `created_at` (string): Creation timestamp - `created_at` (string): Creation timestamp
**Status Codes:** **Status Codes:**
- 201: Created - 201: Created
- 400: Bad Request - 400: Invalid request
- 401: Unauthorized - 401: Unauthorized
- 409: Conflict (folder already exists) - 409: Folder already exists
} }
+21 -15
View File
@@ -1,15 +1,21 @@
meta { meta {
name: Delete Ebook Folder name: Delete Ebook Folder
type: http type: http
seq: 7 seq: 10
} }
delete { delete {
url: {{base_url}}/api/auth/ebook-folders/{{folder_path}} url: {{base_url}}/api/auth/ebook-folders
body: none body: json
auth: inherit auth: inherit
} }
body:json {
{
"folder_path": "/home/user/ebooks"
}
}
settings { settings {
encodeUrl: true encodeUrl: true
timeout: 0 timeout: 0
@@ -17,24 +23,24 @@ settings {
docs { docs {
## Delete Ebook Folder ## Delete Ebook Folder
Removes an ebook folder for the authenticated user. Removes an ebook folder for the authenticated user.
**Method:** DELETE **Method:** DELETE
**Endpoint:** /api/auth/ebook-folders/:folderPath **Endpoint:** /api/auth/ebook-folders
**Authentication:** Required **Authentication:** Required
**URL Parameters:** **Request Body:**
- `folderPath` (string): URL-encoded folder path to remove - `folder_path` (string, required): Path to the ebook folder to remove
**Response:** **Response:**
- `message` (string): Success message - `message` (string): Success message
**Status Codes:** **Status Codes:**
- 200: Success - 200: Success
- 400: Bad Request - 400: Invalid request
- 401: Unauthorized - 401: Unauthorized
- 404: Folder not found - 500: Internal server error
} }
+8 -8
View File
@@ -1,7 +1,7 @@
meta { meta {
name: Get Ebook Folders name: Get Ebook Folders
type: http type: http
seq: 6 seq: 9
} }
get { get {
@@ -17,21 +17,21 @@ settings {
docs { docs {
## Get Ebook Folders ## Get Ebook Folders
Retrieves all ebook folders for the authenticated user. Retrieves the list of ebook folders for the authenticated user.
**Method:** GET **Method:** GET
**Endpoint:** /api/auth/ebook-folders **Endpoint:** /api/auth/ebook-folders
**Authentication:** Required **Authentication:** Required
**Response:** Array of folder objects **Response:** Array of folder objects
- `id` (string): Folder ID - `id` (string): Folder ID
- `user_id` (string): User ID - `user_id` (string): User ID
- `folder_path` (string): Folder path - `folder_path` (string): Folder path
- `created_at` (string): Creation timestamp - `created_at` (string): Creation timestamp
**Status Codes:** **Status Codes:**
- 200: Success - 200: Success
- 401: Unauthorized - 401: Unauthorized
+7 -5
View File
@@ -26,11 +26,13 @@ docs {
**Authentication:** Required **Authentication:** Required
**Response:** **Response:**
- `id` (string): User ID - `id` (string): User ID
- `email` (string): Email - `email` (string): Email
- `username` (string): Username - `username` (string): Username
- `theme` (string): User theme preference - `theme` (string): User theme preference
- `first_name` (string, optional): First name
- `last_name` (string, optional): Last name
**Status Codes:** **Status Codes:**
- 200: Success - 200: Success
+2 -2
View File
@@ -5,7 +5,7 @@ meta {
} }
get { get {
url: {{base_url}}/api/users url: {{base_url}}/api/auth/users
body: none body: none
auth: inherit auth: inherit
} }
@@ -22,7 +22,7 @@ docs {
**Method:** GET **Method:** GET
**Endpoint:** /api/users **Endpoint:** /api/auth/users
**Authentication:** Required **Authentication:** Required
+7 -5
View File
@@ -45,11 +45,13 @@ docs {
**Response:** **Response:**
- `token` (string): JWT token - `token` (string): JWT token
- `user` (object): User details - `user` (object): User details
- `id` (string): User ID - `id` (string): User ID
- `email` (string): Email - `email` (string): Email
- `username` (string): Username - `username` (string): Username
- `theme` (string): User theme preference - `theme` (string): User theme preference
- `first_name` (string): First name
- `last_name` (string): Last name
**Status Codes:** **Status Codes:**
- 200: Success - 200: Success
+16 -10
View File
@@ -14,7 +14,9 @@ body:json {
{ {
"email": "test@example.com", "email": "test@example.com",
"username": "testuser", "username": "testuser",
"password": "password123" "password": "password123",
"first_name": "Test",
"last_name": "User"
} }
} }
@@ -40,18 +42,22 @@ docs {
**Endpoint:** /api/auth/register **Endpoint:** /api/auth/register
**Request Body:** **Request Body:**
- `email` (string): Email address - `email` (string): Email address
- `username` (string): Username - `username` (string): Username
- `password` (string): Password - `password` (string): Password
- `first_name` (string, optional): First name
- `last_name` (string, optional): Last name
**Response:** **Response:**
- `token` (string): JWT token - `token` (string): JWT token
- `user` (object): User details - `user` (object): User details
- `id` (string): User ID - `id` (string): User ID
- `email` (string): Email - `email` (string): Email
- `username` (string): Username - `username` (string): Username
- `theme` (string): User theme preference - `theme` (string): User theme preference
- `first_name` (string, optional): First name
- `last_name` (string, optional): Last name
**Status Codes:** **Status Codes:**
- 201: Created - 201: Created
+2 -2
View File
@@ -5,7 +5,7 @@ meta {
} }
put { put {
url: {{base_url}}/api/user/email url: {{base_url}}/api/auth/email
body: json body: json
auth: inherit auth: inherit
} }
@@ -28,7 +28,7 @@ docs {
**Method:** PUT **Method:** PUT
**Endpoint:** /api/user/email **Endpoint:** /api/auth/email
**Authentication:** Required **Authentication:** Required
+12 -12
View File
@@ -5,14 +5,14 @@ meta {
} }
put { put {
url: {{base_url}}/api/user/password url: {{base_url}}/api/auth/password
body: json body: json
auth: inherit auth: inherit
} }
body { body:json {
{ {
"current_password": "currentpassword", "current_password": "password123",
"new_password": "newpassword123", "new_password": "newpassword123",
"confirm_password": "newpassword123" "confirm_password": "newpassword123"
} }
@@ -25,26 +25,26 @@ settings {
docs { docs {
## Update Password ## Update Password
Updates the authenticated user's password. Updates the authenticated user's password.
**Method:** PUT **Method:** PUT
**Endpoint:** /api/user/password **Endpoint:** /api/auth/password
**Authentication:** Required **Authentication:** Required
**Request Body:** **Request Body:**
- `current_password` (string, required): Current password for verification - `current_password` (string, required): Current password for verification
- `new_password` (string, required): New password (minimum 6 characters) - `new_password` (string, required): New password (minimum 6 characters)
- `confirm_password` (string, required): Confirmation of new password - `confirm_password` (string, required): Confirmation of new password
**Response:** **Response:**
- `message` (string): Success message - `message` (string): Success message
**Status Codes:** **Status Codes:**
- 200: Success - 200: Success
- 400: Password validation failed - 400: Password validation failed
- 401: Current password incorrect - 401: Current password incorrect
- 401: Unauthorized - 401: Unauthorized
} }
+47
View File
@@ -0,0 +1,47 @@
meta {
name: Update Profile
type: http
seq: 4
}
put {
url: {{base_url}}/api/auth/profile
body: json
auth: inherit
}
body:json {
{
"first_name": "Updated",
"last_name": "Name"
}
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Update User Profile
Updates the authenticated user's profile information.
**Method:** PUT
**Endpoint:** /api/auth/profile
**Authentication:** Required (Bearer token)
**Request Body:**
- `first_name` (string, optional): First name
- `last_name` (string, optional): Last name
**Response:**
- `message` (string): Success message
**Status Codes:**
- 200: Success
- 400: Invalid request
- 401: Unauthorized
}
+8 -8
View File
@@ -18,23 +18,23 @@ body:json {
docs { docs {
## Update User Theme ## Update User Theme
Updates the authenticated user's theme preference. Updates the authenticated user's theme preference.
**Method:** PUT **Method:** PUT
**Endpoint:** /api/auth/theme **Endpoint:** /api/auth/theme
**Authentication:** Required (Bearer token) **Authentication:** Required (Bearer token)
**Request Body:** **Request Body:**
- `theme` (string): Theme name (tokyo-night, dracula, nord, solarized-dark, monokai, one-dark-pro, material-dark, catppuccin-mocha, catppuccin-macchiato, catppuccin-frappe, catppuccin-latte) - `theme` (string): Theme name (tokyo-night, dracula, nord, solarized-dark, monokai, one-dark-pro, material-dark, catppuccin-mocha, catppuccin-macchiato, catppuccin-frappe, catppuccin-latte)
**Response:** **Response:**
- `message` (string): Success message - `message` (string): Success message
**Status Codes:** **Status Codes:**
- 200: Success - 200: Success
- 400: Invalid theme - 400: Invalid theme
- 401: Unauthorized - 401: Unauthorized
} }
+2 -2
View File
@@ -5,7 +5,7 @@ meta {
} }
put { put {
url: {{base_url}}/api/user/username url: {{base_url}}/api/auth/username
body: json body: json
auth: inherit auth: inherit
} }
@@ -28,7 +28,7 @@ docs {
**Method:** PUT **Method:** PUT
**Endpoint:** /api/user/username **Endpoint:** /api/auth/username
**Authentication:** Required **Authentication:** Required