Frontend Features: - Add ProtectedRoute component with token expiry validation - Create AdminDashboardPage with system statistics and user management - Create AuditLogsPage with filtering and pagination - Add admin-only navigation (Shield icon) for ymirliu@panjit.com.tw - Add admin API methods to apiV2 service - Add admin type definitions (SystemStats, AuditLog, etc.) Token Management: - Auto-redirect to login on token expiry - Check authentication on route change - Show loading state during auth check - Admin privilege verification Backend Testing: - Add pytest configuration (pytest.ini) - Create test fixtures (conftest.py) - Add unit tests for auth, tasks, and admin endpoints - Add integration tests for complete workflows - Test user isolation and admin access control Documentation: - Add TESTING.md with comprehensive testing guide - Include test running instructions - Document fixtures and best practices Routes: - /admin - Admin dashboard (admin only) - /admin/audit-logs - Audit logs viewer (admin only) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
import { Routes, Route, Navigate } from 'react-router-dom'
|
|
import LoginPage from '@/pages/LoginPage'
|
|
import UploadPage from '@/pages/UploadPage'
|
|
import ProcessingPage from '@/pages/ProcessingPage'
|
|
import ResultsPage from '@/pages/ResultsPage'
|
|
import ExportPage from '@/pages/ExportPage'
|
|
import SettingsPage from '@/pages/SettingsPage'
|
|
import TaskHistoryPage from '@/pages/TaskHistoryPage'
|
|
import AdminDashboardPage from '@/pages/AdminDashboardPage'
|
|
import AuditLogsPage from '@/pages/AuditLogsPage'
|
|
import Layout from '@/components/Layout'
|
|
import ProtectedRoute from '@/components/ProtectedRoute'
|
|
|
|
function App() {
|
|
return (
|
|
<Routes>
|
|
{/* Public routes */}
|
|
<Route path="/login" element={<LoginPage />} />
|
|
|
|
{/* Protected routes with layout */}
|
|
<Route
|
|
path="/"
|
|
element={
|
|
<ProtectedRoute>
|
|
<Layout />
|
|
</ProtectedRoute>
|
|
}
|
|
>
|
|
<Route index element={<Navigate to="/upload" replace />} />
|
|
<Route path="upload" element={<UploadPage />} />
|
|
<Route path="processing" element={<ProcessingPage />} />
|
|
<Route path="results" element={<ResultsPage />} />
|
|
<Route path="export" element={<ExportPage />} />
|
|
<Route path="tasks" element={<TaskHistoryPage />} />
|
|
<Route path="settings" element={<SettingsPage />} />
|
|
|
|
{/* Admin routes - require admin privileges */}
|
|
<Route
|
|
path="admin"
|
|
element={
|
|
<ProtectedRoute requireAdmin>
|
|
<AdminDashboardPage />
|
|
</ProtectedRoute>
|
|
}
|
|
/>
|
|
<Route
|
|
path="admin/audit-logs"
|
|
element={
|
|
<ProtectedRoute requireAdmin>
|
|
<AuditLogsPage />
|
|
</ProtectedRoute>
|
|
}
|
|
/>
|
|
</Route>
|
|
|
|
{/* Catch all */}
|
|
<Route path="*" element={<Navigate to="/" replace />} />
|
|
</Routes>
|
|
)
|
|
}
|
|
|
|
export default App
|