University Event Approval component showed "No events found" even though events were created.
The GET /api/events/requests route was still using the old User.findById(req.user.id) pattern instead of the new getUserFromRole() helper function that looks in the correct collection (Alumni, Student, University).
- GET /api/events/requests - Now uses
getUserFromRole()to find university admin - PUT /api/events/requests/:id/approve - Updated to use correct user lookup
- PUT /api/events/requests/:id/reject - Updated to use correct user lookup
- All user ID references - Changed from
req.user.idtouserIdvariable
console.log('🔍 GET /api/events/requests - req.user:', req.user);
console.log('✅ User found:', user.email, 'Role:', userRole);
console.log('🔍 Query for event requests:', query);
console.log('✅ Found', requests.length, 'event requests');console.log('🔍 Fetching event requests with params:', queryParams.toString());
console.log('🔍 Response status:', response.status);
console.log('✅ Event requests data:', data);- Login as University Admin
- Go to University Dashboard
- Check the Event Requests section
- Look at browser console for debug logs
- Look at backend console for debug logs
🔍 Fetching event requests with params:
🔍 Response status: 200
✅ Event requests data: {requests: [...], pagination: {...}}
🔍 GET /api/events/requests - req.user: {id: "...", role: "university"}
✅ User found: university@example.com Role: university
🔍 Query for event requests: {}
✅ Found 1 event requests
🔍 Sample request: {_id: "...", title: "...", status: "Pending"}
✅ Event requests should now appear in the University Dashboard
✅ University admin can approve/reject events
✅ Full event approval workflow works
- Alumni creates event → EventRequest saved
- University admin sees it in dashboard → Can approve/reject
- Approved events become visible to students
- Students can register for events
The event approval system should now be fully functional! 🎉