From 76ca0ef35915df393689d9e3239bc23f0473a17f Mon Sep 17 00:00:00 2001 From: fnzksxl Date: Thu, 29 Aug 2024 02:21:21 +0900 Subject: [PATCH] =?UTF-8?q?#88=20Feat:=20=ED=8C=80=EC=9E=A5->=20=ED=8C=80?= =?UTF-8?q?=20=EC=99=84=EB=A3=8C=20API=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wtnt/user/profile/service.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/wtnt/user/profile/service.py b/wtnt/user/profile/service.py index 7b90a78..b373a40 100644 --- a/wtnt/user/profile/service.py +++ b/wtnt/user/profile/service.py @@ -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)