feat: 为所有 Server Actions 添加对应的 REST API 端点#33
Closed
missish wants to merge 3 commits intoding113:mainfrom
Closed
Conversation
完善 API 层,为所有 src/actions 中的 Server Actions 创建对应的 HTTP REST API 端点, 支持前端通过标准 HTTP 请求调用所有业务功能。 - 新增 36 个 API 端点文件 - 覆盖 10 个功能模块 - 遵循 RESTful 设计规范 - 管理员和用户端点分离 - 复用 Actions 鉴权逻辑,避免重复代码
Contributor
Author
|
该设计为便于api远程调用,望合并 |
Owner
|
感谢提交~ 很棒的工作 |
Contributor
Author
其实可以考虑把用到actions的地方都替换成api请求,毕竟这是一个管理面板也无需考虑服务端渲染 |
Owner
Server Action 是原作者的设计,本分支新增的功能诸如排行榜已经有对外的 API 接口可用 |
Contributor
Author
确实重构难度挺高,我也只是提个建议,毕竟使用api搭配@tanstack/react-query这些请求库开发体验也会好不少 |
异步类型错误并清理未使用导入 - 修复 admin/keys/[id]/limits 路由的 params 类型错误(Next.js 15 要求异步) - 移除 model-prices、sensitive-words、usage-logs、users/me 等路由中的未使用导入 - 优化代码格式和参数命名
Owner
|
hi,我把这个需求放在 #42 里实现了。位于"系统设置"(/settings)内。实现思路稍有不同,但应该会更加便于后期维护。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
完善 API 层,为所有 src/actions 中的 Server Actions 创建对应的 HTTP REST API 端点, 支持前端通过标准 HTTP 请求调用所有业务功能。
详细变更说明(Detailed Changes)
新增文件(36 个)
1. 用户管理 API (5 files)
功能:
2. 供应商管理 API (5 files)
功能:
3. 密钥管理 API (6 files)
功能:
4. 模型价格管理 API (5 files)
功能:
5. 统计数据 API (1 file)
功能:
6. 使用日志 API (3 files)
功能:
7. 概览数据 API (1 file)
功能:
8. Session 管理 API (5 files)
功能:
9. 敏感词管理 API (5 files)
功能:
修改的文件(1 个)
修复类型错误
变更:
新增文档(4 个)
技术细节(Technical Details)
设计原则
RESTful 风格
路径规范
/api/admin/*/api/*/api/{resource}/api/{resource}/{id}/{subresource}权限分离
错误处理
代码质量
测试状态
破坏性变更(Breaking Changes)
无破坏性变更
所有新增 API 均为新功能,不影响现有代码。