feat: implement user profile endpoints (task 31)

- Add GET /api/users/:id for profile retrieval with stats
- Add PATCH /api/users/:id for profile updates
- Add GET /api/users/:id/reports to fetch user's reports
- Add GET /api/users/:id/events to fetch user's events (registered & organized)
- Add PATCH /api/users/:id/preferences for notification settings
- Add POST /api/users/:id/calculate-impact for impact score calculation
- Create userService with all business logic
- Create userController with request handling
- Create userRoutes and register in main server
- Update frontend userService with new endpoints
- Add comprehensive documentation in USER_PROFILE_ENDPOINTS.md
- Add test script for manual endpoint testing

Requirements satisfied: 6.3, 6.4, 6.5, 10.4
This commit is contained in:
2025-11-16 21:38:16 +00:00
parent f02f23e185
commit c84bcb2fd6
8 changed files with 1151 additions and 4 deletions

View File

@@ -5,6 +5,7 @@ import dotenv from 'dotenv';
import path from 'path';
import reportRoutes from './routes/reportRoutes';
import eventRoutes from './routes/eventRoutes';
import userRoutes from './routes/userRoutes';
// Load environment variables
dotenv.config();
@@ -39,6 +40,7 @@ app.get('/health', (req, res) => {
// API Routes
app.use('/api/reports', reportRoutes);
app.use('/api/events', eventRoutes);
app.use('/api/users', userRoutes);
// Error handling middleware
app.use((err: any, req: express.Request, res: express.Response, next: express.NextFunction) => {