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 4c5e609 commit c35dad2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions wtnt/user/profile/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,15 @@ def get_like_activity(self):

return data

def get_not_approved_team(self):
owner_id = self.request.user.id
team_data = Team.objects.filter(leader_id=owner_id, is_approved=False)
serializer = TeamListSerializer(team_data, many=True)

data = TeamResponse.get_team_list_response(serializer.data, owner_id)

return data


class MyTeamManageService(BaseServiceWithCheckOwnership, BaseServiceWithCheckLeader):
def get_my_teams(self):
Expand Down
2 changes: 2 additions & 0 deletions wtnt/user/profile/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
UserManageActivityView,
UserManageActivityDetailView,
UserLikeTeamView,
NotApprovedTeamView,
)

urlpatterns = [
Expand All @@ -17,4 +18,5 @@
path("team-manage/<int:user_id>", UserManageActivityView.as_view(), name="profile-team-manage"),
path("like/<int:user_id>", UserLikeTeamView.as_view(), name="like-team-list"),
path("team-manage/detail/<int:team_id>", UserManageActivityDetailView.as_view(), name="profile-team-manage-detail"),
path("<int:user_id>/not-approved", NotApprovedTeamView.as_view(), name="not-approved-team"),
]
11 changes: 11 additions & 0 deletions wtnt/user/profile/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,14 @@ def get(self, request, *args, **kwargs):
data = myactivity_service.get_like_activity()

return Response({"team": data}, status=status.HTTP_200_OK)


class NotApprovedTeamView(APIView):
permission_classes = [IsApprovedUser]

def get(self, request, *args, **kwargs):
myactivity_service = MyActivityServcie(request, **kwargs)
myactivity_service.check_ownership()
data = myactivity_service.get_not_approved_team()

return Response({"team": data}, status=status.HTTP_200_OK)

0 comments on commit c35dad2

Please sign in to comment.