fix: E2E 测试发现的后端 BUG 修复 — 限流拆分 + 积分查询 + 错误码修正
- 拆分 refresh token 限流为独立中间件(30次/分 vs 登录5次/分) - 修复积分 recent-activity 500:JOIN 通过 points_account 中间表 - 修复患者/医生不存在返回 400 → 正确的 404 NotFound
This commit is contained in:
@@ -669,6 +669,15 @@ async fn main() -> anyhow::Result<()> {
|
||||
))
|
||||
.with_state(state.clone());
|
||||
|
||||
// Refresh token routes — higher rate limit (30/min) than login (5/min)
|
||||
let refresh_routes = Router::new()
|
||||
.merge(erp_auth::AuthModule::refresh_routes())
|
||||
.layer(axum::middleware::from_fn_with_state(
|
||||
state.clone(),
|
||||
middleware::rate_limit::rate_limit_refresh_by_ip,
|
||||
))
|
||||
.with_state(state.clone());
|
||||
|
||||
// Unthrottled public routes (health, docs, brand) — no rate limiting
|
||||
let unthrottled_routes = Router::new()
|
||||
.merge(handlers::health::health_check_router())
|
||||
@@ -746,6 +755,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
"/api/v1",
|
||||
unthrottled_routes
|
||||
.merge(public_routes)
|
||||
.merge(refresh_routes)
|
||||
.merge(protected_routes)
|
||||
.nest("/fhir", fhir_routes),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user