Merged
Conversation
…arts
1. Created three new dedicated report pages:
* `/dashboard/admin/reports/users`: Charts for monthly signups, total users, growth trend, and role distribution, plus a data table.
* `/dashboard/admin/reports/events`: Charts for status distribution, status count, and top-performing events, plus data tables.
* `/dashboard/admin/reports/registrations`: Charts for attendance overview, top events, attendance rates, and registrations vs. attendance, plus a data table.
2. Updated the main `/dashboard/admin/reports` page to be a simple navigation hub with buttons for the three new reports.
3. Created reusable chart components for consistency:
* `ChartTooltip.tsx` (dark mode-aware)
* `ChartCard.tsx` (wrapper)
* `EmptyChartState.tsx`
* All charts include loading, error, and responsive states.
4. Fixed two TypeScript build errors in the new chart components:
* Added a null check `(percent || 0)` for a chart label function.
* Transformed data for the Pie chart (from `{role, count}` to `{name, value}`) to match the Recharts API.
1. Updated the default `ADMIN_EMAIL` from `admin@eventmanagement.com` to `admin@ems.com`.
* Modified in `scripts/modules/utils.py`.
* Updated the corresponding error message in `scripts/seed.py`.
2. The seed script now uses `admin@ems.com` by default. This can still be overridden by the `ADMIN_EMAIL` environment variable.
… usage
1. Fixed a Next.js build error ("Expected 2-3 arguments") caused by passing too many arguments to `logger.error`.
* Replaced instances of `logger.error` with `logger.errorWithContext` to allow for additional context objects.
2. Files updated:
* ems-client/app/dashboard/admin/reports/users/page.tsx
* ems-client/lib/api/admin.api.ts
3. The build should now succeed.
…no sessions
1. Fixed a bug where event-level speakers (at events with no sessions) would not load.
* Root Cause: `loadAllSpeakers` was only triggered if `sessions.length > 0`. Events with no sessions relied on attendance data, but the effect would set `allSpeakers` to `[]` before attendance was available.
2. Fixes Implemented:
* Removed the `sessions.length > 0` guard, ensuring `loadAllSpeakers` always runs when sessions or invitations change.
* Added a new effect to serve as a fallback: it calls `loadAllSpeakers` when `sessions.length === 0` but speaker attendance data *does* exist.
* Added a debug log to confirm when this fallback is used.
3. This ensures speakers are visible regardless of whether sessions exist, and the speaker list is no longer incorrectly cleared by the attendance logic.
…based dashboard redirect
1. Implemented role selection for new OAuth sign-ups across frontend and backend.
* Backend Changes (auth-service):
- `oauth.routes.ts` accepts `role` query parameter and passes it via the OAuth state.
- `auth.service.ts`'s `findOrCreateGoogleUser` now accepts and validates the `role` (USER/SPEAKER) for new user creation.
- Existing users linking accounts retain their current role.
* Frontend Changes (ems-client):
- `register/page.tsx` Google button now passes the selected role to the OAuth endpoint.
2. Refactored the post-OAuth flow for role-based dashboard redirection.
* Backend Changes (auth-service):
- `oauth.routes.ts` now redirects directly to the role-specific dashboard (`/dashboard/admin`, `/dashboard/speaker`, `/dashboard/attendee`) after successful authentication, passing the token in the URL query.
* Frontend Refactor (HOC):
- Updated `withAuth` HOC to handle token processing centrally:
- Detects `token` and `oauth=true` in the URL query.
- Stores the token via `tokenManager.setToken()`.
- Calls `checkAuth()` to authenticate the user and load the profile.
- Removes the query parameters from the URL.
- Prevents the premature redirect to login while processing the token.
* Removed duplicate token extraction and processing logic from individual dashboard pages (attendee, speaker, admin).
3. Configuration Update:
* Updated the default `FRONTEND_URL` in `auth-service` from `http://localhost:3000` to `http://localhost` for the OAuth redirect.
1. Fixed a bug where new users signing up via OAuth with the SPEAKER role did not have a speaker profile created.
* Problem: This resulted in the "Your speaker profile could not be loaded" error when accessing the speaker dashboard.
2. Solution: Updated `findOrCreateGoogleUser` in `auth.service.ts` to call `createSpeakerProfile()` when a new user is created with the SPEAKER role.
3. Flow: The speaker profile creation is now triggered asynchronously via a message sent to RabbitMQ, ensuring the speaker service creates the necessary profile for a successful dashboard load.
1. Implemented new functionality in the backend to unsuspend users.
* Created POST endpoint `/admin/unsuspend-users` (auth-service).
* Accepts an array of user emails and sets their `isActive` status to `true`.
* **Crucially, this endpoint does not modify `emailVerified`** (unlike the `/admin/activate-users` route).
* Includes backend protection to prevent unsuspending users with the ADMIN role.
* Returns the count of successfully unsuspended and not-found users.
2. Implemented corresponding changes in the admin frontend (ems-client).
* Added `unsuspendUsers()` method to `admin.api.ts` to call the new endpoint.
* Updated `users/page.tsx` to display a new **"Unsuspend" button** (green styling) for inactive users.
* Added a **confirmation dialog** before execution.
* Automatically reloads the user list upon successful action.
3. The user management panel now fully supports toggling user status (suspend/unsuspend) with clear UI feedback.
…pension/unsuspension
1. Implemented cross-service type definitions for suspension notifications:
* Added `ACCOUNT_SUSPENDED` and `ACCOUNT_UNSUSPENDED` to the `MESSAGE_TYPE` enum in both `auth-service` and `notification-service`.
* Created `AccountSuspendedNotification` and `AccountUnsuspendedNotification` interfaces in the notification service.
2. Created new email templates in `notification-service`:
* `generateAccountSuspendedEmail()`: Includes warning styling (red header) and support contact info.
* `generateAccountUnsuspendedEmail()`: Includes success styling (green header) and a dashboard link.
3. Integrated email sending functionality into `auth-service` via RabbitMQ:
* Added `sendAccountSuspendedEmail()` and `sendAccountUnsuspendedEmail()` methods to `AuthService` to publish notification messages.
4. Updated Admin Routes in `auth-service` for notification logic:
* `/admin/suspend-users` now checks if the user is already suspended (skips if so) and sends the suspension email upon success.
* `/admin/unsuspend-users` now checks if the user is already active (skips if so) and sends the unsuspension email upon success.
* **Crucially, both routes handle email failures gracefully**, ensuring the suspend/unsuspend operation completes even if the notification fails.
🧪 Test Results ❌
Summary: All automated checks have been completed for this PR. |
🧪 Test Results ❌
Summary: All automated checks have been completed for this PR. |
🧪 Test Results ❌
Summary: All automated checks have been completed for this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.