diff --git a/bruno/user/admin/Delete Account.yml b/bruno/user/admin/Delete Account.yml deleted file mode 100644 index a76565b..0000000 --- a/bruno/user/admin/Delete Account.yml +++ /dev/null @@ -1,25 +0,0 @@ -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 diff --git a/bruno/user/admin/Delete User.yml b/bruno/user/admin/Delete User.yml new file mode 100644 index 0000000..b370c53 --- /dev/null +++ b/bruno/user/admin/Delete User.yml @@ -0,0 +1,25 @@ +info: + name: Delete User + type: http + seq: 12 +http: + method: DELETE + url: '{{base_url}}/api/auth/profile/{{user_id}}' + auth: inherit + +docs: |- + ## Delete User Account + + Delete a user account. Users can delete their own account, admins can delete any user. + + **Method:** DELETE + + **Endpoint:** /api/auth/profile (self) or /api/auth/profile/:id (admin) + + **Authentication:** Required (Bearer token) + + **Status Codes:** + - 200: Success + - 400: Cannot delete the last admin + - 403: Not an admin (when trying to delete another user) + - 404: User not found diff --git a/bruno/user/admin/Reset User Password.yml b/bruno/user/admin/Reset User Password.yml new file mode 100644 index 0000000..0aacd6b --- /dev/null +++ b/bruno/user/admin/Reset User Password.yml @@ -0,0 +1,36 @@ +info: + name: Reset User Password + type: http + seq: 11 +http: + method: PUT + url: '{{base_url}}/api/auth/password/{{user_id}}' + auth: inherit + body: + type: json + jsonBody: |- + { + "new_password": "NewSecurePassword123!", + "confirm_password": "NewSecurePassword123!" + } + +docs: |- + ## Admin Reset User Password + + Admin-only endpoint to reset another user's password. + + **Method:** PUT + + **Endpoint:** /api/auth/password/:id + + **Authentication:** Required (Admin Bearer token) + + **Request Body:** + - `new_password` (string, required): New password + - `confirm_password` (string, required): Must match new_password + + **Status Codes:** + - 200: Success + - 400: Passwords do not match or invalid format + - 403: Not an admin + - 404: User not found diff --git a/bruno/user/admin/Update User.yml b/bruno/user/admin/Update User.yml new file mode 100644 index 0000000..6e38281 --- /dev/null +++ b/bruno/user/admin/Update User.yml @@ -0,0 +1,42 @@ +info: + name: Update User + type: http + seq: 10 +http: + method: PUT + url: '{{base_url}}/api/auth/profile/{{user_id}}' + auth: inherit + body: + type: json + jsonBody: |- + { + "username": "newusername", + "email": "newemail@example.com", + "role": "admin" + } + +docs: |- + ## Admin Update User + + Admin-only endpoint to update another user's profile. + + **Method:** PUT + + **Endpoint:** /api/auth/profile/:id + + **Authentication:** Required (Admin Bearer token) + + **Request Body:** + - `username` (string, optional): New username + - `email` (string, optional): New email + - `first_name` (string, optional): First name + - `last_name` (string, optional): Last name + - `theme` (string, optional): Theme preference + - `role` (string, optional): Role ("user" or "admin") - admin only + + **Status Codes:** + - 200: Success + - 400: Invalid role or cannot demote last admin + - 403: Not an admin + - 404: User not found + - 409: Username or email already taken diff --git a/bruno/user/profile/Update Email.yml b/bruno/user/profile/Update Email.yml deleted file mode 100644 index 456f5aa..0000000 --- a/bruno/user/profile/Update Email.yml +++ /dev/null @@ -1,33 +0,0 @@ -info: - name: Update Email - type: http - seq: 2 -http: - method: PUT - url: '{{base_url}}/api/auth/email' - auth: inherit - body: - type: json - -docs: |- - ## Update Email - - Updates the authenticated user's email address. - - **Method:** PUT - - **Endpoint:** /api/auth/email - - **Authentication:** Required - - **Request Body:** - - `email` (string, required): New email address (must be valid email format) - - **Response:** - - `message` (string): Success message - - **Status Codes:** - - 200: Success - - 400: Invalid email format - - 401: Unauthorized - - 409: Email already taken diff --git a/bruno/user/profile/Update Profile.yml b/bruno/user/profile/Update Profile.yml index 0575185..c486d40 100644 --- a/bruno/user/profile/Update Profile.yml +++ b/bruno/user/profile/Update Profile.yml @@ -8,7 +8,14 @@ http: auth: inherit body: type: json - jsonBody: "{\n \"first_name\": \"Updated\",\n \"last_name\": \"Name\"" + jsonBody: |- + { + "username": "updateduser", + "email": "updated@example.com", + "first_name": "Updated", + "last_name": "User", + "theme": "dracula" + } docs: |- ## Update User Profile @@ -22,8 +29,11 @@ docs: |- **Authentication:** Required (Bearer token) **Request Body:** + - `username` (string, optional): New username (must be unique) + - `email` (string, optional): New email address (must be unique) - `first_name` (string, optional): First name - `last_name` (string, optional): Last name + - `theme` (string, optional): Theme preference **Response:** - `message` (string): Success message @@ -32,3 +42,4 @@ docs: |- - 200: Success - 400: Invalid request - 401: Unauthorized + - 409: Username or email already taken diff --git a/bruno/user/profile/Update Theme.yml b/bruno/user/profile/Update Theme.yml index e6a81fb..34cbd05 100644 --- a/bruno/user/profile/Update Theme.yml +++ b/bruno/user/profile/Update Theme.yml @@ -1,19 +1,22 @@ info: name: Update Theme type: http - seq: 4 + seq: 5 http: method: PUT url: '{{base_url}}/api/auth/theme' auth: inherit body: type: json - jsonBody: "{\n \"theme\": \"dracula\"" + jsonBody: |- + { + "theme": "dracula" + } docs: |- - ## Update User Theme + ## Update Theme - Updates the authenticated user's theme preference. + Fast theme switching for the application UI. **Method:** PUT @@ -22,7 +25,7 @@ docs: |- **Authentication:** Required (Bearer token) **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, required): Theme name **Response:** - `message` (string): Success message diff --git a/bruno/user/profile/Update Username.yml b/bruno/user/profile/Update Username.yml deleted file mode 100644 index 7ecfd39..0000000 --- a/bruno/user/profile/Update Username.yml +++ /dev/null @@ -1,33 +0,0 @@ -info: - name: Update Username - type: http - seq: 1 -http: - method: PUT - url: '{{base_url}}/api/auth/username' - auth: inherit - body: - type: json - -docs: |- - ## Update Username - - Updates the authenticated user's username. - - **Method:** PUT - - **Endpoint:** /api/auth/username - - **Authentication:** Required - - **Request Body:** - - `username` (string, required): New username (3-50 characters) - - **Response:** - - `message` (string): Success message - - **Status Codes:** - - 200: Success - - 400: Invalid username - - 401: Unauthorized - - 409: Username already taken