- 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
68 lines
1.4 KiB
Plaintext
68 lines
1.4 KiB
Plaintext
meta {
|
|
name: Register Admin User
|
|
type: http
|
|
seq: 4
|
|
}
|
|
|
|
post {
|
|
url: {{base_url}}/api/auth/register
|
|
body: json
|
|
auth: inherit
|
|
}
|
|
|
|
body:json {
|
|
{
|
|
"email": "admin@example.com",
|
|
"username": "admin",
|
|
"password": "admin123",
|
|
"first_name": "Admin",
|
|
"last_name": "User",
|
|
"role": "admin"
|
|
}
|
|
}
|
|
|
|
script:post-response {
|
|
function onResponse(res) {
|
|
let data = res.getBody();
|
|
return bru.setEnvVar("token", data.token, { persist: true });
|
|
}
|
|
onResponse(res);
|
|
}
|
|
|
|
settings {
|
|
encodeUrl: true
|
|
timeout: 0
|
|
}
|
|
|
|
docs {
|
|
## Register Admin User
|
|
|
|
Creates a new admin user account.
|
|
|
|
**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
|
|
- 409: User exists
|
|
} |