You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create an authenticated route to return a user’s profile info along with polls they’ve created and participated in. If the user is an admin, include that role in the response.
Route: GET /api/users/:userId/profile (auth required)
Returns user info: firstName, lastName, userName, email, and role (e.g. "user" or "admin")
Includes:
createdPolls: polls created by the user
participatedPolls: polls viewed or voted on by the user
Ensure password and sensitive fields are excluded
If the user is an admin, include "role": "admin" in the JSON response