Skip to content

Commit

Permalink
Merge pull request #504 from bounswe/basic-user-getter
Browse files Browse the repository at this point in the history
Basic user getter implementation
  • Loading branch information
hakanaktas0 authored Nov 26, 2023
2 parents df32a06 + 15e1ade commit 150ce8a
Show file tree
Hide file tree
Showing 2 changed files with 14 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
13 changes: 13 additions & 0 deletions project/backend/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ 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(user_id=request.user.id)

return JsonResponse({'basic_user_id':user.id,
'bio':user.bio,
'email_notification_preference': user.email_notification_preference,
'show_activity_preference':user.show_activity_preference},status=200)


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

0 comments on commit 150ce8a

Please sign in to comment.