Skip to content

Commit

Permalink
#69 fix : modfiy friends search api
Browse files Browse the repository at this point in the history
  • Loading branch information
0321minji committed Sep 19, 2024
1 parent d4843ae commit db004cc
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions friends/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ def get(self,request):
serializers=self.FindFriendInputSerializer(data=request.query_params)
serializers.is_valid()
email=serializers.validated_data.get('email')
if email:
user=get_object_or_404(User,email=email)

user = User.objects.filter(email=email).first()

if user:
if user==request.user:
print('here')
return Response({
Expand All @@ -48,11 +48,11 @@ def get(self,request):
'data':output_serializer.data,
},status=status.HTTP_200_OK)
else:
friend, created = Friend.objects.get_or_create(user=request.user)
serializer = self.FindFriendOutputSerializer(friend.friends.all(), many=True)
# friend, created = Friend.objects.get_or_create(user=user)
# serializer = self.FindFriendOutputSerializer(user)
return Response({
"status": "success",
"data": serializer.data
"status": "fail",
"data": "해당 email을 가진 유저가 없습니다."
},status=status.HTTP_200_OK)

#친구 신청 보내기
Expand Down

0 comments on commit db004cc

Please sign in to comment.