Skip to content

Commit

Permalink
docs: described actions accept and reject
Browse files Browse the repository at this point in the history
  • Loading branch information
Akay7 committed Jun 6, 2024
1 parent 6e8a0cd commit a1556c2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions backend/friend_request/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def perform_create(self, serializer):
permission_classes=[IsAuthenticated, IsForCurrentUser],
)
def accept(self, request, pk=None):
"""Accept a friend request of another user."""
friend_request = self.get_object()
friend_request.accepted_at = timezone.now()
friend_request.rejected_at = None
Expand All @@ -69,6 +70,7 @@ def accept(self, request, pk=None):
permission_classes=[IsAuthenticated, IsForCurrentUser],
)
def reject(self, request, pk=None):
"""Reject a friend request of another user."""
friend_request = self.get_object()
friend_request.rejected_at = timezone.now()
friend_request.save(update_fields=["rejected_at"])
Expand Down

0 comments on commit a1556c2

Please sign in to comment.