Skip to content

fix: return 404 when updating a missing member profile#4351

Merged
skwowet merged 2 commits into
mainfrom
fix/member-update-null-check
Jul 15, 2026
Merged

fix: return 404 when updating a missing member profile#4351
skwowet merged 2 commits into
mainfrom
fix/member-update-null-check

Conversation

@skwowet

@skwowet skwowet commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes 500 errors on PUT /member/:id when the member no longer exists in the database. MemberRepository.update called record.get() before verifying findOne returned a row, causing TypeError: Cannot read properties of null (reading 'get') instead of a proper 404.

Changes

  • Reorder null check before captureOldState in MemberRepository.update, matching the pattern already used in organizationRepository.update.

Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
@skwowet skwowet self-assigned this Jul 15, 2026
Copilot AI review requested due to automatic review settings July 15, 2026 16:25
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Correctly returns 404 for updates to missing members by checking the lookup result before audit-state capture.

Changes:

  • Moves the null check before record.get().
  • Preserves audit capture for existing members.

Review note: The PR title is missing the required trailing JIRA key (CM-XXX).


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@skwowet skwowet merged commit 9cca88d into main Jul 15, 2026
13 checks passed
@skwowet skwowet deleted the fix/member-update-null-check branch July 15, 2026 16:41
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.

2 participants