feat: Complete implementation of Tasks 1-5 - CIM Document Processor
Backend Infrastructure: - Complete Express server setup with security middleware (helmet, CORS, rate limiting) - Comprehensive error handling and logging with Winston - Authentication system with JWT tokens and session management - Database models and migrations for Users, Documents, Feedback, and Processing Jobs - API routes structure for authentication and document management - Integration tests for all server components (86 tests passing) Frontend Infrastructure: - React application with TypeScript and Vite - Authentication UI with login form, protected routes, and logout functionality - Authentication context with proper async state management - Component tests with proper async handling (25 tests passing) - Tailwind CSS styling and responsive design Key Features: - User registration, login, and authentication - Protected routes with role-based access control - Comprehensive error handling and user feedback - Database schema with proper relationships - Security middleware and validation - Production-ready build configuration Test Coverage: 111/111 tests passing Tasks Completed: 1-5 (Project setup, Database, Auth system, Frontend UI, Backend infrastructure) Ready for Task 6: File upload backend infrastructure
This commit is contained in:
59
backend/src/routes/auth.ts
Normal file
59
backend/src/routes/auth.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { Router } from 'express';
|
||||
import {
|
||||
register,
|
||||
login,
|
||||
logout,
|
||||
refreshToken,
|
||||
getProfile,
|
||||
updateProfile
|
||||
} from '../controllers/authController';
|
||||
import {
|
||||
authenticateToken,
|
||||
authRateLimit
|
||||
} from '../middleware/auth';
|
||||
|
||||
const router = Router();
|
||||
|
||||
/**
|
||||
* @route POST /api/auth/register
|
||||
* @desc Register a new user
|
||||
* @access Public
|
||||
*/
|
||||
router.post('/register', authRateLimit, register);
|
||||
|
||||
/**
|
||||
* @route POST /api/auth/login
|
||||
* @desc Login user
|
||||
* @access Public
|
||||
*/
|
||||
router.post('/login', authRateLimit, login);
|
||||
|
||||
/**
|
||||
* @route POST /api/auth/logout
|
||||
* @desc Logout user
|
||||
* @access Private
|
||||
*/
|
||||
router.post('/logout', authenticateToken, logout);
|
||||
|
||||
/**
|
||||
* @route POST /api/auth/refresh
|
||||
* @desc Refresh access token
|
||||
* @access Public
|
||||
*/
|
||||
router.post('/refresh', authRateLimit, refreshToken);
|
||||
|
||||
/**
|
||||
* @route GET /api/auth/profile
|
||||
* @desc Get current user profile
|
||||
* @access Private
|
||||
*/
|
||||
router.get('/profile', authenticateToken, getProfile);
|
||||
|
||||
/**
|
||||
* @route PUT /api/auth/profile
|
||||
* @desc Update current user profile
|
||||
* @access Private
|
||||
*/
|
||||
router.put('/profile', authenticateToken, updateProfile);
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user