feat: 完成API接口隔离设计和定义
Some checks failed
部署管理后台 / 🧪 测试和构建 (push) Failing after 1m5s
部署管理后台 / 🔒 安全扫描 (push) Has been skipped
部署前端网站 / 🧪 测试和构建 (push) Failing after 2m0s
部署管理后台 / 🚀 部署到生产环境 (push) Has been skipped
部署后端服务 / 🚀 构建并部署 (push) Has been skipped
部署后端服务 / 🧪 测试后端 (push) Failing after 3m15s
部署前端网站 / 🚀 部署到生产环境 (push) Has been skipped
部署管理后台 / 🔄 回滚部署 (push) Has been skipped
部署后端服务 / 🔄 回滚部署 (push) Has been skipped

🚀 主要功能:
- 创建前端公共展示API (/api/v1/public/*)
- 创建前端用户认证API (/api/v1/auth/*)
- 创建管理后台完整API (/admin/*)
- 实现双重认证体系设计

📋 新增文件:
- api/desc/frontend/public.api - 前端公共接口定义
- api/desc/frontend/auth.api - 前端认证接口定义
- api/desc/admin.api - 管理后台主入口
- api/desc/admin/auth.api - 管理员认证接口
- api/desc/admin/users.api - 用户管理接口
- api/desc/admin/photos.api - 照片管理接口
- api/desc/admin/categories.api - 分类管理接口
- api/desc/admin/dashboard.api - 仪表板统计接口

🔧 更新文件:
- api/desc/common.api - 扩展类型定义支持前端和管理后台
- api/desc/photography.api - 更新为前端主入口
- etc/photographyapi-api.yaml - 修复中间件配置

📚 文档:
- docs/API_SEPARATION_DESIGN.md - 接口隔离设计方案
- docs/API_REFACTORING_TASKS.md - 详细任务规划
- docs/COMPLETED_TASKS_ARCHIVE.md - 已完成任务归档

 特性亮点:
- 前端和管理后台权限完全隔离
- 优化的数据结构去除敏感信息
- 完整的CRUD和统计功能
- 支持批量操作和高级筛选
- 详细的仪表板分析功能
This commit is contained in:
xujiang
2025-07-11 16:08:02 +08:00
parent 6efccae78a
commit 8a0792500e
16 changed files with 2150 additions and 25 deletions

View File

@ -0,0 +1,117 @@
syntax = "v1"
import "common.api"
// 前端公共展示接口 - 无需认证
// 获取照片列表请求
type GetPublicPhotoListRequest {
PageRequest
CategoryId int64 `form:"category_id,optional"`
Keyword string `form:"keyword,optional"`
Sort string `form:"sort,optional,default=created_at_desc"` // created_at_desc, created_at_asc, title_asc, title_desc
}
// 获取照片列表响应
type GetPublicPhotoListResponse {
BaseResponse
Data PublicPhotoListData `json:"data"`
}
type PublicPhotoListData {
PageResponse
Photos []PublicPhoto `json:"photos"`
}
// 获取照片详情请求
type GetPublicPhotoRequest {
Id int64 `path:"id"`
}
// 获取照片详情响应
type GetPublicPhotoResponse {
BaseResponse
Data PublicPhoto `json:"data"`
}
// 获取精选照片响应
type GetFeaturedPhotosResponse {
BaseResponse
Data []PublicPhoto `json:"data"`
}
// 获取最新照片请求
type GetRecentPhotosRequest {
Limit int `form:"limit,optional,default=12"`
}
// 获取最新照片响应
type GetRecentPhotosResponse {
BaseResponse
Data []PublicPhoto `json:"data"`
}
// 获取分类列表响应
type GetPublicCategoryListResponse {
BaseResponse
Data []PublicCategory `json:"data"`
}
// 获取分类详情请求
type GetPublicCategoryRequest {
Id int64 `path:"id"`
}
// 获取分类详情响应
type GetPublicCategoryResponse {
BaseResponse
Data PublicCategoryWithPhotos `json:"data"`
}
// 获取分类下的照片请求
type GetCategoryPhotosRequest {
Id int64 `path:"id"`
PageRequest
Sort string `form:"sort,optional,default=created_at_desc"`
}
// 获取分类下的照片响应
type GetCategoryPhotosResponse {
BaseResponse
Data PublicPhotoListData `json:"data"`
}
// 前端公共接口组 - 无需认证
@server(
group: public
prefix: /api/v1/public
)
service photography-api {
@doc "获取照片列表"
@handler getPublicPhotoList
get /photos (GetPublicPhotoListRequest) returns (GetPublicPhotoListResponse)
@doc "获取照片详情"
@handler getPublicPhoto
get /photos/:id (GetPublicPhotoRequest) returns (GetPublicPhotoResponse)
@doc "获取精选照片"
@handler getFeaturedPhotos
get /photos/featured returns (GetFeaturedPhotosResponse)
@doc "获取最新照片"
@handler getRecentPhotos
get /photos/recent (GetRecentPhotosRequest) returns (GetRecentPhotosResponse)
@doc "获取分类列表"
@handler getPublicCategoryList
get /categories returns (GetPublicCategoryListResponse)
@doc "获取分类详情"
@handler getPublicCategory
get /categories/:id (GetPublicCategoryRequest) returns (GetPublicCategoryResponse)
@doc "获取分类下的照片"
@handler getCategoryPhotos
get /categories/:id/photos (GetCategoryPhotosRequest) returns (GetCategoryPhotosResponse)
}