add /friends endpoint
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
j3d1 2023-06-22 02:14:52 +02:00
parent 0b92db278b
commit 91cd5c57b3
15 changed files with 251 additions and 17 deletions

View file

View file

@ -0,0 +1,24 @@
from django.urls import path
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework.viewsets import ViewSetMixin
from authentication.signature_auth import SignatureAuthentication
from toolshed.serializers import FriendSerializer
class Friends(APIView, ViewSetMixin):
authentication_classes = [SignatureAuthentication]
permission_classes = [IsAuthenticated]
def get(self, request, format=None): # /api/friends/ #
user = request.user
friends = user.friends.all()
serializer = FriendSerializer(friends, many=True)
return Response(serializer.data)
urlpatterns = [
path('friends/', Friends.as_view(), name='friends'),
]