fix: Hero Update Dialog in Freelancer profile correctly updates user and profile fields - #32
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
🟡 Changes recommended
There are verified correctness and reliability issues (tsconfig path alias config, a potential runtime crash in date rendering, and a partial-update bug in the PATCH handler) that should be addressed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR fixes profile editing inconsistencies by ensuring the Freelancer “Hero” edit flow updates the User.name field (separate from Fprofile), adjusts TypeScript config related to path aliasing, and formats the Client “Member Since” display to show only the date portion.
Changes:
- Update Freelancer profile PATCH handler to also update the
Userdocument when the hero “name” is changed. - Remove
baseUrlfromtsconfig.json. - Format “Member Since” to show only the date (YYYY-MM-DD).
File summaries
| File | Description |
|---|---|
| tsconfig.json | Removes baseUrl while keeping paths alias configuration. |
| app/api/profile/FreelancerProfile/route.ts | Splits PATCH updates into profile fields vs user fields (name), and applies user update. |
| app/(Cinterface)/Cprofile/page.tsx | Changes “Member Since” display to show only the date portion. |
Review details
- Files reviewed: 2/3 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| <div className="absolute top-0 right-0 w-32 h-32 bg-white/10 rounded-full -mr-16 -mt-16"></div> | ||
| <h3 className="text-sm font-semibold uppercase tracking-wide mb-2">Member Since</h3> | ||
| <p className="text-3xl font-bold">{user?.createdAt || "N/A"}</p> | ||
| <p className="text-3xl font-bold">{user?.createdAt.split('T')[0] || "N/A"}</p> |
| console.log(updateProfileFields) | ||
| console.log(updateUserFields) |
| if (Object.keys(updateUserFields).length > 0) { | ||
| await User.findByIdAndUpdate(userId, { $set: updateUserFields }, { new: true }); | ||
| } | ||
|
|
||
| if (!updated) { | ||
| return NextResponse.json({ success: false, error: "Freelancer profile not found" }, { status: 404 }); | ||
| } |
Description
The hero section in Freelancer profile had
namefield fromUsermodel and remaining fields fromProfilemodel. The name was not updated properly ecause of this. Had separately update the name field in Users.Changes
Member Sincesection, to show only the date.