Skip to content

Linh - Fix edit/update API behavior for Weekly Summary Email recipients#2070

Merged
one-community merged 2 commits intodevelopmentfrom
linh_fix_weekly_summary_email_backend
Mar 6, 2026
Merged

Linh - Fix edit/update API behavior for Weekly Summary Email recipients#2070
one-community merged 2 commits intodevelopmentfrom
linh_fix_weekly_summary_email_backend

Conversation

@linh2020
Copy link
Copy Markdown
Contributor

@linh2020 linh2020 commented Feb 25, 2026

Description

This PR fixes the backend update endpoint used by Weekly Summary recipient editing. Previously, valid edit requests could fail with 400 Bad Request when edited email was not found in userProfile.

Related PRs (if any):

This backend PR is related to the frontend PR#3927

Main changes explained:

Updated PUT /api/AssignWeeklySummaryEmail/:id logic:

  • still validates email format,
  • always allows valid email update,
  • only updates assignedTo when edited email maps to a userProfile,
  • preserves existing assignedTo if no matching user is found,
  • returns updated populated assignment as { assignment: ... },
  • returns 409 for duplicate-email conflicts.

Added controller unit tests for:

  • update with no matching user profile,
  • update with matching user profile (assignedTo remap),
  • duplicate email conflict (409).

How to test:

Checkout this branch
Call PUT /api/AssignWeeklySummaryEmail/:id with valid email in body.

Verify:

  • response 200 with { assignment: ... },
  • email updates in DB,
  • if email matches an existing user, assignedTo udates,
  • if no matching user, update still succeeds (no 400).
  • Verify duplicate email returns 409.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

@Anusha-Gali Anusha-Gali left a comment

Choose a reason for hiding this comment

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

Hi Linh,

I have reviewed your PR locally and am able to view the updated email in the backend. I would appreciate if there were toast notifications involved with any add, edit, delete upon save however it isn't mentioned in the requirement document.

Image Image Image

@one-community
Copy link
Copy Markdown
Member

Thank you all, merging!

@one-community one-community merged commit ca6978a into development Mar 6, 2026
3 checks passed
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.

3 participants