Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: team delete message for associated projects #6142

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions backend/api/teams/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ def delete(self, team_id):
"SubCode": "UserNotTeamManager",
}, 401

TeamService.delete_team(team_id)
return {"Success": "Team deleted"}, 200
return TeamService.delete_team(team_id)


class TeamsAllAPI(Resource):
Expand Down
6 changes: 5 additions & 1 deletion backend/services/team_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,12 @@ def delete_team(team_id: int):

if team.can_be_deleted():
team.delete()
return {"Success": "Team deleted"}, 200
else:
raise TeamServiceError("Team has projects, cannot be deleted")
return {
"Error": "Team has projects, cannot be deleted",
"SubCode": "This team has projects associated. Before deleting team, unlink any associated projects.",
}, 400

@staticmethod
def check_team_membership(project_id: int, allowed_roles: list, user_id: int):
Expand Down
Loading