ob-dj-store 0.0.20.9__py3-none-any.whl → 0.0.21__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ob_dj_store/apis/stores/rest/serializers/serializers.py +20 -8
- ob_dj_store/apis/stores/views.py +6 -12
- {ob_dj_store-0.0.20.9.dist-info → ob_dj_store-0.0.21.dist-info}/METADATA +1 -1
- {ob_dj_store-0.0.20.9.dist-info → ob_dj_store-0.0.21.dist-info}/RECORD +6 -6
- {ob_dj_store-0.0.20.9.dist-info → ob_dj_store-0.0.21.dist-info}/WHEEL +0 -0
- {ob_dj_store-0.0.20.9.dist-info → ob_dj_store-0.0.21.dist-info}/top_level.txt +0 -0
@@ -1647,11 +1647,10 @@ class WalletTransactionSerializer(serializers.ModelSerializer):
|
|
1647
1647
|
]
|
1648
1648
|
|
1649
1649
|
|
1650
|
-
class
|
1651
|
-
def to_representation(self,
|
1650
|
+
class GroupedWalletTransactionListSerializer(serializers.ListSerializer):
|
1651
|
+
def to_representation(self, data):
|
1652
1652
|
result_dict = OrderedDict()
|
1653
|
-
|
1654
|
-
for wallettransaction in instance:
|
1653
|
+
for wallettransaction in data:
|
1655
1654
|
year = wallettransaction.created_at.year
|
1656
1655
|
month = wallettransaction.created_at.month
|
1657
1656
|
title = f"{datetime(year, month, 1).strftime('%b')}, {year}"
|
@@ -1660,12 +1659,25 @@ class WalletTransactionListSerializer(serializers.Serializer):
|
|
1660
1659
|
result_dict[title] = {"title": title, "data": []}
|
1661
1660
|
|
1662
1661
|
result_dict[title]["data"].append(
|
1663
|
-
|
1664
|
-
wallettransaction, context=self.context
|
1665
|
-
).data
|
1662
|
+
self.child.to_representation(wallettransaction)
|
1666
1663
|
)
|
1667
1664
|
|
1668
|
-
return
|
1665
|
+
return list(result_dict.values())
|
1666
|
+
|
1667
|
+
|
1668
|
+
class WalletTransactionListSerializer(serializers.ModelSerializer):
|
1669
|
+
class Meta:
|
1670
|
+
model = WalletTransaction
|
1671
|
+
fields = [
|
1672
|
+
"id",
|
1673
|
+
"type",
|
1674
|
+
"amount",
|
1675
|
+
"created_at",
|
1676
|
+
"wallet",
|
1677
|
+
"is_cashback",
|
1678
|
+
"is_refund",
|
1679
|
+
]
|
1680
|
+
list_serializer_class = GroupedWalletTransactionListSerializer
|
1669
1681
|
|
1670
1682
|
|
1671
1683
|
class ReorderSerializer(serializers.Serializer):
|
ob_dj_store/apis/stores/views.py
CHANGED
@@ -1100,22 +1100,16 @@ class WalletViewSet(
|
|
1100
1100
|
tags=["Wallet",],
|
1101
1101
|
)
|
1102
1102
|
@action(
|
1103
|
-
methods=["GET"
|
1103
|
+
methods=["GET"],
|
1104
1104
|
detail=True,
|
1105
1105
|
url_path="transactions",
|
1106
1106
|
serializer_class=WalletTransactionListSerializer,
|
1107
1107
|
)
|
1108
|
-
def transactions(
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
if page is not None:
|
1114
|
-
serializer = self.get_serializer(page)
|
1115
|
-
return self.get_paginated_response(serializer.data)
|
1116
|
-
|
1117
|
-
serializer = self.get_serializer(queryset)
|
1118
|
-
return Response(serializer.data)
|
1108
|
+
def transactions(self, request, *args, **kwargs):
|
1109
|
+
wallet = self.get_object()
|
1110
|
+
queryset = wallet.transactions.all().order_by("-created_at")
|
1111
|
+
serializer = WalletTransactionListSerializer(queryset, many=True)
|
1112
|
+
return Response({"results": serializer.data})
|
1119
1113
|
|
1120
1114
|
@swagger_auto_schema(
|
1121
1115
|
operation_summary="List Wallet selection images",
|
@@ -2,8 +2,8 @@ ob_dj_store/apis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
|
|
2
2
|
ob_dj_store/apis/stores/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
ob_dj_store/apis/stores/filters.py,sha256=lDb-wS7dEsSS0XL2qN4XqoRKYSEDgxhVZLBPGL0pPM4,9764
|
4
4
|
ob_dj_store/apis/stores/urls.py,sha256=7vwogfIGcKS0hHYK3iBXKQwi1kCA_vuHY1eZt8rAspg,2021
|
5
|
-
ob_dj_store/apis/stores/views.py,sha256=
|
6
|
-
ob_dj_store/apis/stores/rest/serializers/serializers.py,sha256=
|
5
|
+
ob_dj_store/apis/stores/views.py,sha256=YCYZ3XlJLFOwhpqMU-Lvx_emJwW-0fdyEF2SXROEmNU,41405
|
6
|
+
ob_dj_store/apis/stores/rest/serializers/serializers.py,sha256=mhUS1LmnZpFY5OAnGbiMBwD6zywC7tZ8vKK1bVniJTE,67087
|
7
7
|
ob_dj_store/apis/tap/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
ob_dj_store/apis/tap/serializers.py,sha256=KPrBK4h2-fWvEVf6vOj2ww5-USV9WqpyYicIqoHIiXI,1065
|
9
9
|
ob_dj_store/apis/tap/urls.py,sha256=bnOTv6an11kxpo_FdqlhsizlGPLVpNxBjCyKcf3_C9M,367
|
@@ -159,7 +159,7 @@ ob_dj_store/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
159
159
|
ob_dj_store/utils/helpers.py,sha256=o7wgypM7mI2vZqZKkhxnTcnHJC8GMQDOuYMnRwXr6tY,2058
|
160
160
|
ob_dj_store/utils/model.py,sha256=DV7hOhTaZL3gh9sptts2jTUFlTArKG3i7oPioq9HLFE,303
|
161
161
|
ob_dj_store/utils/utils.py,sha256=8UVAFB56qUSjJJ5f9vnermtw638gdFy4CFRCuMbns_M,1342
|
162
|
-
ob_dj_store-0.0.
|
163
|
-
ob_dj_store-0.0.
|
164
|
-
ob_dj_store-0.0.
|
165
|
-
ob_dj_store-0.0.
|
162
|
+
ob_dj_store-0.0.21.dist-info/METADATA,sha256=nNHhaaoDX74DIVkXI3-7yGfjgene_TVIED1B8dx0bxo,2848
|
163
|
+
ob_dj_store-0.0.21.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
164
|
+
ob_dj_store-0.0.21.dist-info/top_level.txt,sha256=CZG3G0ptTkzGnc0dFYN-ZD7YKdJBmm47bsmGwofD_lk,12
|
165
|
+
ob_dj_store-0.0.21.dist-info/RECORD,,
|
File without changes
|
File without changes
|