Skip to content

Feat: Team member leave endpoint #116

@Ayoobf

Description

@Ayoobf

Allow any team member (including leaders) to leave their current team. Special handling is required when the team leader leaves, which should trigger team disbandment.

Link to spec: https://rutgersconnect-my.sharepoint.com/:w:/g/personal/af940_em_rutgers_edu/EaxDKLS42aJAvBkPgIKlu5QBgZk9WiVYXw8V3Ut8lYuMjg?e=dwVkjK

Below is what the new user and teams object fields look like for future reference
Image

Specifics

Method: POST
Path: /teams/leave
Return: 200 on successful leave, appropriate error codes for validation failures

Schema:

// Request body

{
  "auth_token": "string",
  "auth_email": "string",
  "team_id": "string"
}

// Response body (success)

{
  "statusCode": 200,
  "body": {
    "message": "Successfully left team",
  }
}

Implementation Logic:

  • Validate user is actually a member of the specified team
  • Remove user's email from team's members array
  • Clear user's team_info object and set confirmed_team = false
  • Special case: If leaving user is team leader, call team disband endpoint

Edge Cases:

  • User tries to leave team they're not in
  • Team already disbanded
  • Concurrent leave operations
  • Leader leaves when team has pending invitations

Team Disbandment Integration:

When team leader leaves, automatically trigger the disband workflow:

  • Call /teams/disband endpoint internally
  • Ensure all remaining members are properly cleaned up
  • Handle any pending invitations to the disbanded team

Deliverables:

  • Implement endpoint with validation and error handling
  • Write unit tests including leader succession scenarios
  • Integration testing with team disband functionality
    • Depending on time of creating this endpoint, the disband endpoint may not be done yet

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions