Skip to content

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

Open
linh2020 wants to merge 2 commits intodevelopmentfrom
linh_fix_weekly_summary_email_backend
Open

Linh - Fix edit/update API behavior for Weekly Summary Email recipients#2070
linh2020 wants to merge 2 commits intodevelopmentfrom
linh_fix_weekly_summary_email_backend

Conversation

@linh2020
Copy link
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):

Frontend pair PR: #3927 (and prior related work #3671, #1478, #1440)

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 link

@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

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