transaction filters only success and fail

This commit is contained in:
rizwanisready
2024-05-27 17:07:36 +05:30
parent 97bae9e940
commit a3d31f8dd7
2 changed files with 13 additions and 5 deletions

View File

@@ -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)
return ApiResponse.success(message=constants.SUCCESS, data=version_data.data)

View File

@@ -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 = {