-
Notifications
You must be signed in to change notification settings - Fork 5
fix issue with profile update #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe updateAMember controller flow was changed so that when a file upload returns a new image URL it is assigned into the update payload (propagated to parsedBody.profilePhoto) before calling member update; tests were updated to expect profilePhoto in the update object. Minor formatting only elsewhere. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Controller as member.controller
participant UploadSvc as uploadService
participant MemberSvc as memberService
Client->>Controller: PATCH /members/:id (form-data + optional file)
Controller->>Controller: parse body -> parsedBody
alt file provided
Controller->>UploadSvc: uploadFile(file)
UploadSvc-->>Controller: imageUrl
Controller->>Controller: parsedBody.profilePhoto = imageUrl
end
Controller->>MemberSvc: updateMember(id, parsedBody /* includes profilePhoto */)
MemberSvc-->>Controller: updatedMember
Controller-->>Client: 200 OK (updatedMember)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/Member.test.ts (1)
125-192: Consider adding a test case for simultaneous field update and image upload.The current test suite covers:
- Updating fields without image upload
- Uploading image with empty
memberData- Updating password
However, there's no test case that verifies the behavior when both regular fields (e.g.,
github,memberDatafields with the uploadedprofilePhoto.Would you like me to generate a test case that covers this scenario?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tests/Member.test.ts(1 hunks)
🔇 Additional comments (1)
tests/Member.test.ts (1)
182-184: LGTM! Test correctly reflects the profile photo update implementation.The controller implementation at line 90 (
if (imageUrl) parsedBody.profilePhoto = imageUrl;) exactly matches what the test expects. The uploaded image URL is assigned toparsedBody.profilePhotoand passed toupdateMember, ensuring the new profile photo is persisted to the member record.
Summary by CodeRabbit
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.