Skip to content

feat: add PUT /api/v1/services/{id} endpoint#83

Merged
Wolido merged 5 commits into
mainfrom
feat/add-service-update-api
May 29, 2026
Merged

feat: add PUT /api/v1/services/{id} endpoint#83
Wolido merged 5 commits into
mainfrom
feat/add-service-update-api

Conversation

@Wolido
Copy link
Copy Markdown
Owner

@Wolido Wolido commented May 29, 2026

变更

  • 新增 UpdateServiceRequest 模型,支持部分更新(name, description, usage, is_public)
  • 新增 update_service handler,动态 SQL 构建,仅更新传入的字段
  • 在 /api/v1/services/{id} 注册 PUT 路由
  • 空请求体时直接返回当前服务信息
  • 新增 5 个集成测试(完整更新、部分更新、404、权限、空请求体)

测试

  • cargo test 通过(366 passed, 0 failed)

Wolido added 5 commits May 29, 2026 21:22
- Add UpdateServiceRequest model with optional fields (name, description, usage, is_public)
- Implement update_service handler with dynamic SQL (partial update support)
- Register PUT route at /api/v1/services/{id}
- Add 5 integration tests covering full update, partial update, 404, forbidden, empty body
- Add update_service() to OaaSClient and MockOaaSClient
- Add Edit button and edit form to Admin Service Management tab
- Fix None vs empty string comparison when checking field changes
list_services returns ServiceListItem which does not include usage field.
Add 9 unit tests covering:
- Full field update via PUT
- Partial update (only changed fields sent)
- Empty payload fallback to GET current service
- 404 not found handling
- Network error handling
- Mock client full/partial/empty/not-found scenarios

All 100 tests pass.
@Wolido Wolido merged commit c2d26d8 into main May 29, 2026
6 checks passed
@Wolido Wolido deleted the feat/add-service-update-api branch May 29, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant