Refactor order creation and add configuration endpoints
Refactored order creation logic to use new serializers and transaction handling, improving validation and modularity. Introduced admin and public endpoints for shop configuration with sensitive fields protected. Enhanced Zásilkovna (Packeta) integration, including packet widget template, new API fields, and improved error handling. Added django-silk for profiling, updated requirements and settings, and improved frontend Orval config for API client generation.
This commit is contained in:
24
backend/thirdparty/zasilkovna/serializers.py
vendored
24
backend/thirdparty/zasilkovna/serializers.py
vendored
@@ -15,16 +15,27 @@ class ZasilkovnaPacketSerializer(serializers.ModelSerializer):
|
||||
"weight",
|
||||
"return_routing",
|
||||
]
|
||||
read_only_fields = fields
|
||||
read_only_fields = [
|
||||
"id",
|
||||
"created_at",
|
||||
"barcode",
|
||||
"state",
|
||||
"weight",
|
||||
"return_routing",
|
||||
]
|
||||
|
||||
|
||||
#Just for tracking URL of packet
|
||||
class TrackingURLSerializer(serializers.Serializer):
|
||||
barcode = serializers.CharField(read_only=True)
|
||||
tracking_url = serializers.URLField(read_only=True)
|
||||
|
||||
|
||||
|
||||
# -- SHIPMENT --
|
||||
|
||||
class ZasilkovnaShipmentSerializer(serializers.ModelSerializer):
|
||||
packets = serializers.PrimaryKeyRelatedField(many=True, read_only=True)
|
||||
packets = serializers.PrimaryKeyRelatedField(many=True)
|
||||
|
||||
class Meta:
|
||||
model = ZasilkovnaShipment
|
||||
@@ -33,6 +44,11 @@ class ZasilkovnaShipmentSerializer(serializers.ModelSerializer):
|
||||
"created_at",
|
||||
"shipment_id",
|
||||
"barcode",
|
||||
"packets",
|
||||
"packets",
|
||||
]
|
||||
read_only_fields = [
|
||||
"id",
|
||||
"created_at",
|
||||
"shipment_id",
|
||||
"barcode",
|
||||
]
|
||||
read_only_fields = fields
|
||||
|
||||
Reference in New Issue
Block a user