Skip to content

Commit

Permalink
fix: team delete message for associated projects
Browse files Browse the repository at this point in the history
  • Loading branch information
kaditya97 committed Nov 24, 2023
1 parent 5b895a4 commit 009023d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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 a team, unlink any associated projects."
}, 400

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

0 comments on commit 009023d

Please sign in to comment.