Skip to content

Conversation

@Harish-Naruto
Copy link
Member

@Harish-Naruto Harish-Naruto commented Nov 21, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Profile image uploads: new profile photo URLs are now correctly processed and applied to member profiles.
  • Tests

    • Updated tests to validate that profilePhoto is included when a member's profile is updated.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 21, 2025

Walkthrough

The 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

Cohort / File(s) Summary
Member controller image upload fix
src/controllers/member.controller.ts
When an uploaded file returns an image URL, that URL is now assigned to imageUrl and propagated into parsedBody.profilePhoto before calling update logic; minor formatting/newline adjustments.
Tests updated to expect profilePhoto
tests/Member.test.ts
Tests for updateAMember updated to expect updateMember(id, updates) to include profilePhoto (new image URL) in the updates object.

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)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Primary logic change in one controller function plus test updates.
  • Review focus areas:
    • src/controllers/member.controller.ts — verify imageUrl assignment and edge cases (no-file, existing image deletion).
    • tests/Member.test.ts — ensure assertions match new behavior and mock expectations for uploadService.
    • Integration points with upload/delete behavior and memberService.updateMember payload.

Possibly related PRs

  • Minor fixes #27 — modifies same controller updateAMember and image propagation; strong overlap.
  • Minor fixes #38 — also adjusts updateAMember upload/delete and propagation behavior.
  • Achievement fixes #26 — addresses same issue assigning uploaded image URL into profilePhoto.

Suggested reviewers

  • i-am-that-guy

Poem

"🐇 I hopped to patch a wandering URL,
A snap that found its rightful shell,
Now pictures stick where they belong,
A tiny fix, a cheerful song,
Hooray — the profile looks so well!"

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix issue with profile update' is directly related to the main change: fixing the profile image URL assignment in the updateAMember endpoint, which is a profile update issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch member-Profile-update-fix

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.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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:

  1. Updating fields without image upload
  2. Uploading image with empty memberData
  3. Updating password

However, there's no test case that verifies the behavior when both regular fields (e.g., github, linkedin) are updated AND an image is uploaded in the same request. This would ensure that the controller correctly merges the parsed memberData fields with the uploaded profilePhoto.

Would you like me to generate a test case that covers this scenario?

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cb0ff6f and a2c06a4.

📒 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 to parsedBody.profilePhoto and passed to updateMember, ensuring the new profile photo is persisted to the member record.

@callofcode07 callofcode07 self-requested a review November 21, 2025 12:51
@callofcode07 callofcode07 merged commit 72f89e0 into main Nov 21, 2025
2 checks passed
@callofcode07 callofcode07 deleted the member-Profile-update-fix branch November 21, 2025 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants