Skip to content

Commit

Permalink
#88 Feat: 팀장-> 팀 완료 API 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
fnzksxl committed Aug 28, 2024
1 parent 8616f92 commit 76ca0ef
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion wtnt/user/profile/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,29 @@ def get_my_team_detail(self):

return data

def finish_project(self):
team_id = self.kwargs.get("team_id")
user_id = self.request.user.id
try:
team = Team.objects.select_related("leader").get(id=team_id)
except Team.DoesNotExist:
raise notfound_exception.TeamNotFoundError()

self.check_leader(user_id, team.leader.id)

team.is_accomplished = True
team.save()

return {"detail": f"{team.title} is accomplished."}

def ban_user_from_team(self):
team_id = self.kwargs.get("team_id")
user_id = self.request.user.id

team = Team.objects.select_related("leader").get(id=team_id)
try:
team = Team.objects.select_related("leader").get(id=team_id)
except Team.DoesNotExist:
raise notfound_exception.TeamNotFoundError()

self.check_leader(user_id, team.leader.id)

Expand Down

0 comments on commit 76ca0ef

Please sign in to comment.