Skip to content

Commit

Permalink
basic user getter implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
hakanaktas0 committed Nov 25, 2023
1 parent 82c2dc4 commit ffc4afd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions project/backend/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
path('signup/', SignUpAPIView.as_view(), name='signup'),
path('login/', obtain_auth_token, name='login'),
path('get_authenticated_user/', UserDetailAPI.as_view(), name='get_authenticated_user'),
path('get_authenticated_basic_user/', BasicUserDetailAPI.as_view(), name='get_authenticated_basic_user'),
path('get_node/', NodeAPIView.as_view(), name='get_node'),
path('search/', search, name='search'),
path('get_profile_info/', get_profile, name='get_profile'),
Expand Down
11 changes: 11 additions & 0 deletions project/backend/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ def get(self, request, *args, **kwargs):

return Response(serializer.data)

class BasicUserDetailAPI(APIView):
authentication_classes = (TokenAuthentication,)
permission_classes = (IsAuthenticated,)

def get(self, request, *args, **kwargs):
user = BasicUser.objects.get(id=request.user.id)
serializer = BasicUserSerializer(user)

return Response(serializer.data)


class ChangePasswordView(generics.UpdateAPIView):
authentication_classes = (TokenAuthentication,)
permission_classes = (IsAuthenticated,)
Expand Down

0 comments on commit ffc4afd

Please sign in to comment.