From 9c64fdcf6149845d834600d0f3641cccfaedb7f2 Mon Sep 17 00:00:00 2001 From: Joyriver-Desktop Date: Mon, 13 Jan 2025 22:14:51 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EC=A7=81=EB=A0=AC=ED=99=94=20=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KUA/student/views.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/KUA/student/views.py b/KUA/student/views.py index e448a8d..78c7062 100644 --- a/KUA/student/views.py +++ b/KUA/student/views.py @@ -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]