-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Describe the bug
Submitting the signup form with a profile image succeeds, but the created user record still has an empty avatarUrl. The controller saves the payload under profilPic, a field that doesn’t exist on the User model, so the avatar never makes it into MongoDB databse and the frontend doesn't show the User's avatar picture.
To Reproduce
Steps to reproduce the behavior:
- Run the backend locally (npm run dev) with a valid MongoDB connection.
- Send a POST request to http://localhost:8080/api/v1/auth/signup with JSON:
- Inspect the 201 response and the users collection in MongoDB.
- Notice avatarUrl is an empty string even though an image URL was provided.
Expected behavior
If a caller supplies an avatar URL (or base64 image), the server should persist it to User.avatarUrl and return the same value in the signup response so the profile displays immediately after account creation.
Screenshots
- API endpoint response - shows even if we pass a ProfilPic the response and db doesn't actually store the image url


- Code snippet

Why this is happening?
- The User schema only defines avatarUrl so from the payload the value that is being parsed as profilePIc is dropped.

Proposed solution
Update the signup controller to destructure avatarUrl from the payload instead of profilePic solve the issue.
Desktop (please complete the following information):
- OS: Windows 11, Arch Linux
- Browser: chrome, firefox
- Version: Latest
Smartphone (please complete the following information):
- Device: N/A
- OS: N/A
- Browser: N/A
- Version: N/A
Additional context
user.controller.js still destructures profilPic from req.body and passes it to the User constructor. The User schema only defines avatarUrl so the value is dropped. Aligning the payload and controller to use avatarUrl resolves the bug.