Skip to content

Commit

Permalink
Merge pull request #25 from nxtbn-com/refactored
Browse files Browse the repository at this point in the history
Refactored
  • Loading branch information
MySecondLanguage committed May 28, 2024
2 parents 94fd60b + b1b9a18 commit 31b7db6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion nxtbn/order/api/storefront/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class GuestOrderSerializer(serializers.ModelSerializer):
billing_address = AddressSerializer(write_only=True, required=False)
cart_data = OrderItemSerializer(many=True, write_only=True)
meta_data = serializers.SerializerMethodField()
total_price = serializers.FloatField(write_only=True)
total_price = serializers.DecimalField(write_only=True, max_digits=12, decimal_places=3) # accepting in unit and soring in subunit

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion nxtbn/order/api/storefront/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class GuestUserOrderCreateAPIView(generics.CreateAPIView):
type=openapi.TYPE_OBJECT,
properties={
'promo_code': openapi.Schema(type=openapi.TYPE_STRING),
'total_price': openapi.Schema(type=openapi.TYPE_NUMBER),
'total_price': openapi.Schema(type=openapi.TYPE_NUMBER, format='decimal'),
'shipping_address': openapi.Schema(type=openapi.TYPE_OBJECT), # Adjust according to your AddressSerializer schema
'billing_address': openapi.Schema(type=openapi.TYPE_OBJECT), # Adjust according to your AddressSerializer schema
'cart_data': openapi.Schema(type=openapi.TYPE_ARRAY, items=openapi.Schema(type=openapi.TYPE_OBJECT)), # Adjust according to your OrderItemSerializer schema
Expand Down
4 changes: 1 addition & 3 deletions nxtbn/users/api/storefront/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# views.py
from rest_framework import generics, status
from rest_framework.response import Response
from rest_framework.views import APIView
Expand Down Expand Up @@ -54,7 +53,6 @@ def create(self, request, *args, **kwargs):


class LoginView(generics.GenericAPIView):
permission_classes = (AllowAny,)
permission_classes = (AllowAny,)
serializer_class = LoginRequestSerializer

Expand Down Expand Up @@ -126,7 +124,7 @@ def post(self, request):
"user": user_data,
"token": {
"access": access_token,
"refresh": refresh_token,
# "refresh": refresh_token,
},
},
status=status.HTTP_200_OK,
Expand Down

0 comments on commit 31b7db6

Please sign in to comment.