From a3d31f8dd7402e8e9d398a7ca9af662e13a3743e Mon Sep 17 00:00:00 2001 From: rizwanisready Date: Mon, 27 May 2024 17:07:36 +0530 Subject: [PATCH] transaction filters only success and fail --- accounts/api/views.py | 10 ++++++---- manage_wallets/api/views.py | 8 +++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/accounts/api/views.py b/accounts/api/views.py index f51223f..54160be 100644 --- a/accounts/api/views.py +++ b/accounts/api/views.py @@ -959,13 +959,15 @@ class VersionCheck(APIView): model = AppVersion def get(self, request, *args, **kwargs): - - device_type = request.GET.get('type') + + device_type = request.GET.get("type") if not device_type: - return ApiResponse.error(message=constants.FAILURE, errors="device type is required") + return ApiResponse.error( + message=constants.FAILURE, errors="device type is required" + ) # Query the database to retrieve the upgrade flags based on the app version version = self.model.objects.filter(app_type=device_type).last() version_data = AppVersionSerializer(version) - return ApiResponse.success(message=constants.SUCCESS, data=version_data.data) \ No newline at end of file + return ApiResponse.success(message=constants.SUCCESS, data=version_data.data) diff --git a/manage_wallets/api/views.py b/manage_wallets/api/views.py index 85deee9..f477a22 100644 --- a/manage_wallets/api/views.py +++ b/manage_wallets/api/views.py @@ -140,7 +140,13 @@ class TransactionView(APIView): permission_classes = [IsAuthenticated] def get(self, request): - queryset = models.Transaction.objects.filter(principal_id=request.user.id) + queryset = models.Transaction.objects.filter( + principal_id=request.user.id, + transaction_status__in=[ + models.TransactionStatus.SUCCESS, + models.TransactionStatus.FAIL, + ], + ) serializer = serializers.TransactionSerializer(queryset, many=True) response = {