Add admin user management

This commit is contained in:
2026-04-03 12:23:44 +00:00
parent 3d37186fa7
commit 5168e52e4b
18 changed files with 989 additions and 19 deletions
+112
View File
@@ -259,6 +259,118 @@ Response 204:
### 5.1 GET /strategy-sets
## 6. Users
All user management endpoints require an admin token.
### 6.1 GET /users
Request:
```bash
curl -X GET "http://localhost:8000/users" \
-H "Authorization: Bearer <ADMIN_TOKEN>"
```
Response 200:
```json
[
{
"id": "user-1",
"username": "alice",
"email": "alice@example.com",
"created_at": "2026-04-03T00:00:00Z",
"updated_at": "2026-04-03T00:00:00Z"
}
]
```
### 6.2 GET /users/{user_id}
Request:
```bash
curl -X GET "http://localhost:8000/users/user-1" \
-H "Authorization: Bearer <ADMIN_TOKEN>"
```
Response 200:
```json
{
"id": "user-1",
"username": "alice",
"email": "alice@example.com",
"created_at": "2026-04-03T00:00:00Z",
"updated_at": "2026-04-03T00:00:00Z"
}
```
### 6.3 POST /users
Request:
```bash
curl -X POST "http://localhost:8000/users" \
-H "Authorization: Bearer <ADMIN_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"username": "alice",
"email": "alice@example.com"
}'
```
Response 201:
```json
{
"id": "user-1",
"username": "alice",
"email": "alice@example.com",
"created_at": "2026-04-03T00:00:00Z",
"updated_at": "2026-04-03T00:00:00Z"
}
```
### 6.4 PATCH /users/{user_id}
Request:
```bash
curl -X PATCH "http://localhost:8000/users/user-1" \
-H "Authorization: Bearer <ADMIN_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"username": "alice-updated"
}'
```
Response 200:
```json
{
"id": "user-1",
"username": "alice-updated",
"email": "alice@example.com",
"created_at": "2026-04-03T00:00:00Z",
"updated_at": "2026-04-03T00:10:00Z"
}
```
### 6.5 DELETE /users/{user_id}
Request:
```bash
curl -X DELETE "http://localhost:8000/users/user-1" \
-H "Authorization: Bearer <ADMIN_TOKEN>"
```
Response 204:
- No content.
Request:
```bash