fix(ci,web): API 路径检查脚本归一化 + DEV 模式路由覆盖率校验
- check-api-paths.sh: 归一化前端硬编码 ID、扩展后端路由提取范围 (users/roles/departments 等基础模块)、排除插件动态路由假阳性 结果: 46 个不匹配 → 0 个,CI PASS - routeConfig.ts: 新增 validateRouteCoverage() 开发模式校验函数 - App.tsx: 挂载时调用路由覆盖率校验,未声明权限的路由会 console.warn
This commit is contained in:
@@ -8,7 +8,7 @@ import { ErrorBoundary } from './components/ErrorBoundary';
|
||||
import { useAuthStore } from './stores/auth';
|
||||
import { useAppStore } from './stores/app';
|
||||
import type { ThemeName } from './stores/app';
|
||||
import { ROUTE_PERMISSIONS, FROZEN_ROUTES } from './routeConfig';
|
||||
import { ROUTE_PERMISSIONS, FROZEN_ROUTES, validateRouteCoverage } from './routeConfig';
|
||||
|
||||
const Home = lazy(() => import('./pages/Home'));
|
||||
const Users = lazy(() => import('./pages/Users'));
|
||||
@@ -244,6 +244,29 @@ export default function App() {
|
||||
document.documentElement.setAttribute('data-theme', themeName);
|
||||
}, [themeName]);
|
||||
|
||||
// DEV mode: validate all routes have permission declarations
|
||||
useEffect(() => {
|
||||
validateRouteCoverage([
|
||||
"/users", "/roles", "/organizations", "/workflow", "/messages", "/settings",
|
||||
"/plugins/admin", "/plugins/market",
|
||||
"/health/statistics", "/health/patients", "/health/tags", "/health/doctors",
|
||||
"/health/appointments", "/health/schedules", "/health/follow-up-tasks",
|
||||
"/health/follow-up-records", "/health/consultations",
|
||||
"/health/points-rules", "/health/points-products", "/health/points-orders",
|
||||
"/health/offline-events", "/health/ai-prompts", "/health/ai-analysis",
|
||||
"/health/ai-usage", "/health/alerts", "/health/alert-dashboard",
|
||||
"/health/alert-rules", "/health/devices", "/health/realtime-monitor",
|
||||
"/health/oauth-clients", "/health/dialysis", "/health/action-inbox",
|
||||
"/health/follow-up-templates", "/health/care-plans", "/health/shifts",
|
||||
"/health/medications", "/health/ble-gateways",
|
||||
"/health/critical-value-thresholds", "/health/diagnoses",
|
||||
"/health/family-proxy", "/health/consents",
|
||||
"/health/articles", "/health/article-categories", "/health/article-tags",
|
||||
"/health/banners", "/health/media-library",
|
||||
"/health/medication-records",
|
||||
]);
|
||||
}, []);
|
||||
|
||||
const isDark = themeName === 'dark';
|
||||
const antTheme = useMemo(() => themeConfigs[themeName] ?? themeConfigs.blue, [themeName]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user