refactor(api)!: align client with canonical HTTP contract

Route all feature requests through business API modules, sync generated DTOs, and add communication tests and architecture documentation.

BREAKING CHANGE: migrate the client to plural resource paths, canonical snake_case fields, ISO timestamps, and explicit paginated responses.
This commit is contained in:
2026-09-30 12:04:58 +08:00
parent 00c6eccb63
commit 8ba0212eec
34 changed files with 1137 additions and 1623 deletions
+6 -4
View File
@@ -1,10 +1,10 @@
# OpenCloud 前端
Vue 3 + TypeScript + Vite 前端,通过 FastAPI 提供认证、云图、图鉴、个人主页和管理后台数据。
Vue 3 + TypeScript + Vite 前端,通过 Hono 后端和 Better Auth 提供认证、云图、图鉴、个人主页和管理后台数据。
## 本地开发
1. 在相邻的 `opencloud-backend` 项目中启动 FastAPI 服务。
1. 在相邻的 `hono-api` 项目中启动后端服务(该仓库的本地启动方式见其 README)。
2. 复制 `.env.example` 为 `.env`,配置高德地图 Key;如果后端不在默认地址,修改 `VITE_API_URL`。
3. 安装依赖并启动前端:
@@ -13,7 +13,7 @@ npm install
npm run dev
```
默认后端地址为 `http://localhost:8000/api/v1`。
默认后端地址为 `http://localhost:3000`。
开发服务器和本地 Preview 都固定使用 `http://localhost:5173`,与后端默认 CORS 配置保持一致。运行 Preview 前请先停止开发服务器。
## 检查与构建
@@ -23,7 +23,7 @@ npm run check
npm run build
```
`check` 依次执行 ESLint、Prettier 格式检查、项目样式检查和 TypeScript 类型检查。也可以单独运行:
`check` 依次执行 ESLint、Prettier 格式检查、项目样式检查、TypeScript 类型检查和通信层测试。也可以单独运行:
```bash
npm run lint # 检查 JS、TS 和 Vue 代码,警告也会导致失败
@@ -45,3 +45,5 @@ VS Code 用户可安装工作区推荐的 Vue、ESLint、Prettier 扩展,保
业务代码按功能集中在 `src/features/`:页面、组件、store 和 composable 放入各自所属模块。跨业务的地图控件集中在 `src/shared/map/`,应用导航位于 `src/components/layout/`,API 客户端、全局样式和公共类型保留独立目录。
新增或移动文件时,参见[目录结构与依赖约定](docs/project-structure.md)。
前后端配套修改时,参见[通信架构与契约同步](docs/api-architecture.md),先生成并同步契约,再运行 `npm run api:check`。该检查需要相邻的后端仓库;前端独立构建使用已提交的类型快照。