Skip to content

Commit

Permalink
Fix: 직렬화 문제 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
joy-river committed Jan 13, 2025
1 parent 9bf18b1 commit 9c64fdc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions KUA/student/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,21 +526,22 @@ class GetPointHistoryView(generics.RetrieveAPIView):
operation_summary="유저의 포인트 사용 기록 반환 뷰",
operation_description="파라미터 입력 x -> 로그인 되어 있는 사용자의 포인트 사용 기록 return",
responses={
201: openapi.Response(description="Success"),
200: openapi.Response(description="Success", schema=serializers.PointHistorySerializer(many=True)),
400: openapi.Response(description="Not Success")
}
)

def get(self, request):
user = request.user

try:
history = models.PointHistory.objects.filter(user=user)
return Response(history, status = 200)

serializer = self.serializer_class(history, many=True)
return Response(serializer.data, status=200)

except:
return Response([], status=400)

except Exception as e:
print(f"Error: {e}")
return Response({"error": "포인트 기록을 가져오는 중 문제가 발생했습니다."}, status=400)

class ImageView(APIView):
authentication_classes = [TokenAuthentication]
Expand Down

0 comments on commit 9c64fdc

Please sign in to comment.