refactor(bruno): reorganize file structure from bruno-yaml to flat bruno directory
- Move all files from bruno-yaml/* to bruno/* - Maintains existing directory structure within categories - Updates bruno/user/auth files with OAuth2 refresh token flow - Updates bruno/user/profile files for user profile management - Adds bruno/dashboard/ directory with dashboard API tests - Preserves all existing test scenarios and OpenCollection YAML format - No functional changes - file reorganization only
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
info:
|
||||
name: Delete Account
|
||||
type: http
|
||||
seq: 4
|
||||
http:
|
||||
method: DELETE
|
||||
url: '{{base_url}}/api/auth/account'
|
||||
auth: inherit
|
||||
body:
|
||||
type: none
|
||||
|
||||
docs: |-
|
||||
## Delete Account
|
||||
|
||||
Permanently deletes user account and all associated data.
|
||||
|
||||
**Method:** DELETE
|
||||
|
||||
**Endpoint:** /api/auth/account
|
||||
|
||||
**Authentication:** Required
|
||||
|
||||
**Usage:**
|
||||
- **Self-deletion**: DELETE /api/auth/account (no parameters)
|
||||
- **Admin deletion**: DELETE /api/auth/account?user_id={uuid
|
||||
@@ -0,0 +1,45 @@
|
||||
info:
|
||||
name: List Users
|
||||
type: http
|
||||
seq: 5
|
||||
http:
|
||||
method: GET
|
||||
url: '{{base_url}}/api/auth/users'
|
||||
auth: inherit
|
||||
body:
|
||||
type: none
|
||||
|
||||
docs: |-
|
||||
## List Users
|
||||
|
||||
Retrieves a list of all users with complete user information.
|
||||
|
||||
**Method:** GET
|
||||
|
||||
**Endpoint:** /api/auth/users
|
||||
|
||||
**Authentication:** Required (Admin only)
|
||||
|
||||
**Response:** Array of user objects with complete information:
|
||||
- `id` (string): User ID (UUID)
|
||||
- `email` (string): Email address
|
||||
- `username` (string): Username
|
||||
- `first_name` (string): First name (empty if not set)
|
||||
- `last_name` (string): Last name (empty if not set)
|
||||
- `role` (string): User role ("user" or "admin")
|
||||
- `theme` (string): Theme preference (empty if default)
|
||||
- `max_devices` (integer): Maximum number of devices allowed
|
||||
- `device_count` (integer): Current number of registered devices
|
||||
- `created_at` (string): Creation timestamp (ISO 8601)
|
||||
- `updated_at` (string): Last update timestamp (ISO 8601)
|
||||
|
||||
**Status Codes:**
|
||||
- 200: Success
|
||||
- 401: Unauthorized
|
||||
- 403: Forbidden (admin access required)
|
||||
|
||||
**Features:**
|
||||
- Admin-only endpoint with complete user information
|
||||
- Returns first_name, last_name, role, theme fields
|
||||
- Includes device limits and current device count
|
||||
- Useful for user management interfaces
|
||||
@@ -0,0 +1,58 @@
|
||||
info:
|
||||
name: Register Admin User
|
||||
type: http
|
||||
seq: 4
|
||||
http:
|
||||
method: POST
|
||||
url: '{{base_url}}/api/auth/register'
|
||||
auth: inherit
|
||||
body:
|
||||
type: json
|
||||
jsonBody: "{\n \"email\": \"maxdevices@example.com\",\n \"username\": \"\
|
||||
maxdevicesuser\",\n \"password\": \"Test@Pass123!\",\n \"first_name\"\
|
||||
: \"Test\",\n \"last_name\": \"User\",\n \"role\": \"admin\""
|
||||
|
||||
docs: |-
|
||||
## Register Admin User
|
||||
|
||||
Creates a new admin user account with role-based restrictions.
|
||||
|
||||
**Method:** POST
|
||||
|
||||
**Endpoint:** /api/auth/register
|
||||
|
||||
**Request Body:**
|
||||
- `email` (string): Email address
|
||||
- `username` (string): Username
|
||||
- `password` (string): Password
|
||||
- `first_name` (string, optional): First name
|
||||
- `last_name` (string, optional): Last name
|
||||
- `role` (string): Must be "admin"
|
||||
|
||||
**Response:**
|
||||
- `token` (string): JWT token with admin role
|
||||
- `user` (object): User details
|
||||
- `id` (string): User ID
|
||||
- `email` (string): Email
|
||||
- `username` (string): Username
|
||||
- `theme` (string): User theme preference
|
||||
- `first_name` (string, optional): First name
|
||||
- `last_name` (string, optional): Last name
|
||||
- `role` (string): User role ("admin")
|
||||
|
||||
**Status Codes:**
|
||||
- 201: Created
|
||||
- 400: Invalid input data
|
||||
- 403: Forbidden - admin creation restrictions apply
|
||||
- 409: User exists
|
||||
|
||||
**Role Restrictions:**
|
||||
- **First User**: Anyone can create first admin (auto-assigned)
|
||||
- **Existing Admins Present**: Only authenticated admins can create new admin accounts
|
||||
- **Unauthenticated Users**: Cannot create admin accounts if any admin exists
|
||||
- **Security**: Requires admin authentication for subsequent admin creation
|
||||
|
||||
**Usage Notes:**
|
||||
- Use this request only when specifically creating admin accounts
|
||||
- For regular user creation, use "Register User" request
|
||||
- Admin token will have elevated privileges for administrative operations
|
||||
@@ -0,0 +1,27 @@
|
||||
info:
|
||||
name: Update User Max Devices
|
||||
type: http
|
||||
seq: 6
|
||||
http:
|
||||
method: PUT
|
||||
url: '{{base_url}}/api/auth/users/{{user_id}}/max-devices'
|
||||
auth: inherit
|
||||
|
||||
docs: |-
|
||||
## Update User Max Devices (Admin)
|
||||
|
||||
Updates the maximum number of devices a user can register.
|
||||
|
||||
**Method:** PUT
|
||||
|
||||
**Endpoint:** /api/auth/users/:id/max-devices
|
||||
|
||||
**Authentication:** Required (Admin only)
|
||||
|
||||
**URL Parameters:**
|
||||
- `id` (string): User ID (UUID)
|
||||
|
||||
**Request Body:**
|
||||
```json
|
||||
{
|
||||
"max_devices": 10
|
||||
@@ -0,0 +1,19 @@
|
||||
info:
|
||||
name: Delete User Account (Admin)
|
||||
type: http
|
||||
seq: 6
|
||||
http:
|
||||
method: DELETE
|
||||
url: '{{base_url}}/api/auth/account?user_id={{user_id}}'
|
||||
auth: inherit
|
||||
body:
|
||||
type: none
|
||||
|
||||
docs: |-
|
||||
## Delete User Account (Admin)
|
||||
|
||||
Allows administrators to delete any user account by specifying user_id parameter.
|
||||
|
||||
**Method:** DELETE
|
||||
|
||||
**Endpoint:** /api/auth/account?user_id={user_id
|
||||
@@ -0,0 +1,16 @@
|
||||
info:
|
||||
name: Update User Max Devices - Exceeds Maximum
|
||||
type: http
|
||||
seq: 3
|
||||
http:
|
||||
method: PUT
|
||||
url: '{{base_url}}/api/auth/users/{{user_id}}/max-devices'
|
||||
auth: inherit
|
||||
|
||||
docs: |-
|
||||
## Update User Max Devices - Invalid (Exceeds Maximum)
|
||||
|
||||
Attempts to set max_devices to 101 (above maximum of 100).
|
||||
|
||||
**Expected:** 400 Bad Request
|
||||
**Response:** `{"error": "validation error"
|
||||
@@ -0,0 +1,16 @@
|
||||
info:
|
||||
name: Update User Max Devices - Invalid Max Devices
|
||||
type: http
|
||||
seq: 2
|
||||
http:
|
||||
method: PUT
|
||||
url: '{{base_url}}/api/auth/users/{{user_id}}/max-devices'
|
||||
auth: inherit
|
||||
|
||||
docs: |-
|
||||
## Update User Max Devices - Invalid (Zero)
|
||||
|
||||
Attempts to set max_devices to 0 (below minimum).
|
||||
|
||||
**Expected:** 400 Bad Request
|
||||
**Response:** `{"error": "validation error"
|
||||
@@ -0,0 +1,16 @@
|
||||
info:
|
||||
name: Update User Max Devices - Missing ID
|
||||
type: http
|
||||
seq: 4
|
||||
http:
|
||||
method: PUT
|
||||
url: '{{base_url}}/api/auth/users//max-devices'
|
||||
auth: inherit
|
||||
|
||||
docs: |-
|
||||
## Update User Max Devices - Missing User ID
|
||||
|
||||
Attempts to update max devices without providing user ID.
|
||||
|
||||
**Expected:** 400 Bad Request
|
||||
**Response:** `{"error": "user id required"
|
||||
@@ -0,0 +1,16 @@
|
||||
info:
|
||||
name: Update User Max Devices - Success
|
||||
type: http
|
||||
seq: 1
|
||||
http:
|
||||
method: PUT
|
||||
url: '{{base_url}}/api/auth/users/{{user_id}}/max-devices'
|
||||
auth: inherit
|
||||
|
||||
docs: |-
|
||||
## Update User Max Devices - Success Case
|
||||
|
||||
Successfully updates a user's max devices limit to 5.
|
||||
|
||||
**Expected:** 200 OK
|
||||
**Response:** `{"message": "max devices updated"
|
||||
Reference in New Issue
Block a user