Skip to content

EMS-143: Fix authentication and improve auditorium experience for all user roles#42

Merged
Buffden merged 18 commits intomainfrom
EMS-143-Core-Speaker-Assignment-User-Stories
Nov 2, 2025
Merged

EMS-143: Fix authentication and improve auditorium experience for all user roles#42
Buffden merged 18 commits intomainfrom
EMS-143-Core-Speaker-Assignment-User-Stories

Conversation

@Buffden
Copy link
Copy Markdown
Owner

@Buffden Buffden commented Nov 2, 2025

Summary

Fixed critical authentication and routing issues that prevented speakers and attendees from accessing attendance features. Enhanced auditorium experience for all user roles with improved material handling and attendance tracking.

🔧 Infrastructure Fixes

• Fixed nginx gateway to forward Authorization header to all backend services (was causing 401 errors)
• Added Docker volume for speaker uploads to persist materials across container restarts
• Reordered booking-service route mounting to prevent authentication conflicts

🔐 Backend Fixes

• Fixed speaker-service auth middleware to correctly extract userId from JWT payload
• Removed role restriction on speaker attendance endpoint to allow all authenticated users
• Fixed route conflicts in speaker-attendance by reordering specific routes before generic ones
• Enhanced material service with robust path resolution for file downloads

📊 Attendance & Booking Improvements

• Fixed attendance tracking to exclude admin users from counts and reports
• Improved getUserInfo helper to fetch actual user details from auth service
• Enhanced live attendance data with proper user names and emails
• Filtered out admins from speaker event registration counts

🎨 Frontend Enhancements

• Restored material validation for speakers joining events
• Fixed API client URL construction for absolute URLs
• Wrapped post-join operations in try-catch for all roles to ensure redirects succeed
• Added redirect to live auditorium after successful speaker join

👥 Auditorium Experience

• Speakers can now see attendee lists in auditorium (like admins)
• Restrict attendance stats card to admin-only
• Fetch and display speaker materials with download capability for all roles
• Show speaker join status and selected materials for attendees
• Rename "Waiting Outside" to "Other Registered Attendees"

📝 Event Management

• Fix speaker events page to show all published events (not just speaker-owned)
• Display only accepted speakers in event details
• Add conditional action buttons based on event ownership
• Improve empty state messages throughout

- Create AttendanceApiClient with join/leave functionality
- Add admin-specific join endpoint support
- Add speaker attendance and material management APIs
- Fix event API endpoint paths
- Add proper error handling and logging

Known Issues: None
- Add EventJoinInterface for unified event joining
- Create SimpleEventJoin, SimpleSpeakerJoin, SimpleAdminJoin components
- Add LiveAttendanceDashboard for real-time attendance display
- Add SpeakerMaterialSelection for material management
- Implement role-based UI with proper state management
- Add automatic redirect to live auditorium after joining

Known Issues: None
… persistent storage for speaker uploads

- Add proxy_set_header Authorization to all service locations in nginx.conf to forward auth tokens
- Add Docker volume for speaker-service uploads to persist uploaded materials
- This fixes 401 errors when speakers/attendees access attendance endpoints through gateway
…ling

- Fix auth.middleware.ts to extract userId from JWT payload correctly (was using decoded.id, now using decoded.userId)
- Remove duplicate /speaker-attendance path from route definitions since already mounted under /api/speaker-attendance
- Reorder speaker-attendance routes to prevent conflicts (specific routes before generic ones)
- Remove role restriction on GET /:eventId endpoint to allow all authenticated users (ADMIN, SPEAKER, USER) to view speaker attendance
- Fix material.service.ts to use absolute paths consistently (path.resolve)
- Enhance downloadMaterial with robust path resolution for both absolute and relative paths
- Improve error logging in material service for better debugging
- Reorder route mounting in index.ts: attendance routes MUST be first to avoid conflicts with booking routes
  Since both mount at '/' and booking routes apply requireUser middleware, this caused 401 errors for speakers
- Refactor getLiveAttendance to filter out admin users from attendance counts
- Add getUserInfo helper to fetch user details from auth service
- Improve attendee details by fetching actual user names and emails
- Fix attendance tracking to exclude admins from counts and reports
- Fix base-api.client.ts to handle absolute URLs correctly (don't prepend baseURL if endpoint already absolute)
- Fix attendance.api.ts endpoints to remove duplicate /api/speaker-attendance path segments
  Corrected endpoints: speakerJoinEvent, updateMaterialsForEvent, getAvailableMaterials, getSpeakerAttendance
- All endpoints now correctly route through nginx gateway
- Restore material validation in SimpleSpeakerJoin: require upload and selection before join
- Wrap post-join operations in try-catch for all roles to ensure redirect happens even if metrics fail
- Add explicit setHasJoined(false) in error handlers for better state management
- Improve error messages to show actual errors
- Add redirect to live auditorium after successful speaker join
- Wrap fetchAttendanceData in SimpleAdminJoin in try-catch
- Wrap getAttendanceMetrics in SimpleEventJoin in try-catch
- Ensures consistency: all users can join auditorium even if post-join data fetch fails
EventDetailsPage.tsx:
- Fetch and display only speakers with ACCEPTED invitations
- Add SpeakerInvitationWithInfo interface for enhanced speaker data
- Fetch speaker profiles to show names and emails
- Add conditional rendering for 'Joined Event' badge based on isAttended
- Update empty state message to clarify invitation workflow

LiveEventAuditorium.tsx:
- Import speakerApiClient and PresentationMaterial types
- Add selectedMaterials state for speaker material details
- Modify loadSpeakerInfo to use speakerAttendanceData for all roles
- Add loadSpeakerAttendanceForAll to fetch data for all authenticated users
- Add loadMaterialDetails to fetch actual material objects with auth headers
- Update display logic:
  * Speaker Info Card: check if ANY speaker has joined
  * Attendance Stats Card: restrict to ADMIN role only
  * Materials Section: display count badge and material list with download buttons
  * Material downloads use same fetch/blob logic as dashboard
- Update empty state messages for better UX
- Rename 'Waiting Outside' to 'Other Registered Attendees'
- Change loadEvents to use eventAPI.getPublishedEvents() instead of getMyEvents()
- Remove status filter since only published events are shown
- Make action buttons (Edit/Delete/Submit) conditional - only show if event.speakerId === user.id
- Update page description to reflect that it shows all published events
- Fix speaker dashboard event visibility
@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 2, 2025

🧪 Test Results ✅

Check Status
Tests ✅ Passed
Coverage ✅ Passed

Summary: All automated checks have been completed for this PR.

@Buffden Buffden merged commit 3b6d16b into main Nov 2, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant