Skip to content

Commit

Permalink
No need to retrieve or update a specific team member
Browse files Browse the repository at this point in the history
  • Loading branch information
suricactus committed Dec 29, 2024
1 parent 4830493 commit 030fc14
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
4 changes: 2 additions & 2 deletions docker-app/qfieldcloud/core/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
),
path(
"organizations/<str:organization_name>/teams/<str:team_name>/members/<str:member_username>/",
teams_views.GetUpdateDestroyTeamMemberView.as_view(),
name="team_member_retrieve_update_destroy",
teams_views.DestroyTeamMemberView.as_view(),
name="team_member_destroy",
),
]
15 changes: 1 addition & 14 deletions docker-app/qfieldcloud/core/views/teams_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def perform_create(self, serializer: TeamSerializer) -> None:
get=extend_schema(description="Retrieve, update, or delete a team member"),
delete=extend_schema(description="Delete a team member"),
)
class GetUpdateDestroyTeamMemberView(generics.RetrieveDestroyAPIView):
class DestroyTeamMemberView(generics.DestroyAPIView):
"""
View to handle adding and listing team members. --> organizations/<str:organization_name>/team/<str:team_name>/members/"
"""
Expand Down Expand Up @@ -217,19 +217,6 @@ def get_full_team_name(self) -> str:

return Team.format_team_name(organization_name, team_name)

def perform_update(self, serializer: TeamMemberSerializer) -> None:
"""
Update logic for the team member.
"""
team_member = self.get_object()
new_username = self.request.data.get("member")

user_member = team_member.member
user_member.username = new_username
user_member.save()

serializer.save()


@extend_schema_view(
get=extend_schema(description="List all members of a team"),
Expand Down

0 comments on commit 030fc14

Please sign in to comment.