Files
photography/backend/test_user_crud.http
xujiang d47e55d5fb feat: 完成用户管理接口核心CRUD功能
- 实现完整的用户创建逻辑,包含唯一性验证和密码加密
- 实现用户详情查询,安全过滤密码字段
- 实现用户信息更新,支持部分字段更新和唯一性验证
- 实现用户删除功能,包含存在性检查和日志记录
- 创建完整的API测试用例,覆盖正常和错误场景
- 更新任务进度文档,标记第10个任务为已完成
- 提升项目整体完成率至35%,中优先级任务完成率至25%
2025-07-11 13:01:50 +08:00

116 lines
2.0 KiB
HTTP

### User Management API
### URL
@baseUrl = http://localhost:8080/api/v1
### 1.
POST {{baseUrl}}/users
Content-Type: application/json
{
"username": "testuser",
"email": "test@example.com",
"password": "123456"
}
### 2.
POST {{baseUrl}}/users
Content-Type: application/json
{
"username": "admin2",
"email": "admin2@example.com",
"password": "123456"
}
### 3. ()
GET {{baseUrl}}/users?page=1&page_size=10
### 4.
GET {{baseUrl}}/users/1
### 5.
PUT {{baseUrl}}/users/1
Content-Type: application/json
{
"username": "updateduser",
"email": "updated@example.com",
"avatar": "http://example.com/avatar.jpg",
"status": 1
}
### 6. ()
PUT {{baseUrl}}/users/1
Content-Type: application/json
{
"status": 0
}
### 7.
DELETE {{baseUrl}}/users/2
###
### 8.
POST {{baseUrl}}/users
Content-Type: application/json
{
"username": "testuser",
"email": "another@example.com",
"password": "123456"
}
### 9.
POST {{baseUrl}}/users
Content-Type: application/json
{
"username": "anotheruser",
"email": "test@example.com",
"password": "123456"
}
### 10.
GET {{baseUrl}}/users/999
### 11.
PUT {{baseUrl}}/users/999
Content-Type: application/json
{
"username": "notexist",
"status": 1
}
### 12.
DELETE {{baseUrl}}/users/999
### 13. -
POST {{baseUrl}}/users
Content-Type: application/json
{
"username": "shortpwd",
"email": "short@example.com",
"password": "123"
}
### 14. -
POST {{baseUrl}}/users
Content-Type: application/json
{
"username": "bademail",
"email": "not-an-email",
"password": "123456"
}
### 15. -
PUT {{baseUrl}}/users/1
Content-Type: application/json
{
"username": "admin"
}