Files
ewoooc/routes/README.md
OoO c2e38be43d
All checks were successful
CD Pipeline / deploy (push) Successful in 1m36s
docs(modularization): 建立模組化治理守門
2026-04-30 14:07:10 +08:00

29 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 路由模組說明
`app.py` 直接註冊所有 Flask Blueprint`USE_MODULAR_ROUTES``register_blueprints()`
`MODULAR_ENDPOINTS` 與 duplicate cleanup 開關已在 ADR-017 Phase 3f-1 移除。
## 啟動防線
`app.py` 會在啟動時檢查 `app.url_map`,同一組 `(URL, HTTP methods)` 不允許被兩個 endpoint
重複註冊;若發現衝突會直接 `SystemExit`
## 模組清單
| 模組 | 說明 | 主要路由 |
|------|------|----------|
| `dashboard_routes.py` | 商品看板首頁 | `/` |
| `sales_routes.py` | 業績分析與 ABC 明細 | `/sales_analysis`, `/growth_analysis`, `/abc_analysis/detail`, `/api/sales_analysis/*` |
| `system_public_routes.py` | 無 prefix 公開系統頁與監控 | `/health`, `/metrics`, `/ai_automation_smoke`, `/api/ai-automation/smoke*`, `/settings`, `/system_settings`, `/logs`, `/api/logs`, `/api/backup` |
| `system_routes.py` | 內部系統維護 API | `/api/system/*` |
| `edm_routes.py` | EDM 與節慶儀表板 | `/edm`, `/festival` |
| `monthly_routes.py` | 月結分析 | `/monthly_summary_analysis`, `/api/monthly_summary_data` |
| `daily_sales_routes.py` | 當日業績 | `/daily_sales`, `/daily_sales/export*` |
| `api_routes.py` | 通用任務與查詢 API | `/api/run_task`, `/api/history/*` |
| `export_routes.py` | 匯出功能 | `/api/export/*` |
| `import_routes.py` | 匯入功能 | `/api/import_excel`, `/api/import/monthly_summary` |
新增 route 時請優先放入對應 Blueprint並用本機 `app.url_map` duplicate check 驗證。
若 route 內開始出現大量資料處理、SQL、AI prompt 或外部 API 呼叫,請依
`docs/guides/modularization_governance.md` 抽到 `services/``utils/`,不要讓 Blueprint 變成新巨檔。