Skip to content

Diya fix: Fixed Team Deactivation#2119

Open
DiyaWadhwani wants to merge 1 commit intodevelopmentfrom
Diya_Fix_TeamDeactivation
Open

Diya fix: Fixed Team Deactivation#2119
DiyaWadhwani wants to merge 1 commit intodevelopmentfrom
Diya_Fix_TeamDeactivation

Conversation

@DiyaWadhwani
Copy link
Contributor

Description

Fixes a bug where deactivating a team without a team code would return a 400 Bad Request error, preventing the team from being deactivated.

Related PRs (if any):

None

Main changes explained:

  • Updated putTeam in the team controller to convert null teamCode to an empty string before saving, so it passes the schema validator which accepts empty string but not null

How to test:

  1. Check out the current branch
  2. Run npm install and start the backend locally
  3. Clear site data/cache
  4. Log in as an admin user
  5. Navigate to the Teams Management page
  6. Find a team that has no team code assigned (example: 22222222222)
  7. Click the active status indicator to deactivate it
  8. Verify the team deactivates successfully with a 200 response
  9. Verify that a team that has a team code also still deactivates successfully

Screenshots or videos of changes:

TeamDeactivation.mp4

Note:

The root cause was that the Team schema validator uses the regex /^(.{5,7}|^$)$/ which allows 5-7 characters or empty string, but not null. When a team has no team code, the frontend sends "teamCode": null which failed validation. The fix converts null to empty string before saving, which aligns with the schema's default: ''.

@sonarqubecloud
Copy link

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.

1 participant