Refactor code structure for improved readability and maintainability

This commit is contained in:
2025-12-07 02:58:37 +01:00
parent 4cbebff43b
commit 5b066e2770
5 changed files with 14 additions and 2 deletions

View File

@@ -11,7 +11,7 @@ class ShopConfiguration(models.Model):
contact_email = models.EmailField(max_length=254, blank=True, null=True)
contact_phone = models.CharField(max_length=20, blank=True, null=True)
contact_address = models.TextField(blank=True, null=True)
opening_hours = models.JSONField(blank=True, null=True) #FIXME: vytvoř tvar pro otvírací dobu
opening_hours = models.JSONField(blank=True, null=True) #FIXME: vytvoř JSON tvar pro otvírací dobu, přes validátory
#Social
facebook_url = models.URLField(max_length=200, blank=True, null=True)

View File

@@ -2,4 +2,5 @@ from django.shortcuts import render
# Create your views here.
#TODO: dej public tag pro view, aby to mohl react číst pomocí public axiosu
#TODO: dej public tag pro view
# rozdělit fieldy podle práv aby se třeba neexposelo citlivé údaje

BIN
backend/thirdparty/zasilkovna/api.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -10,10 +10,16 @@ logger = logging.getLogger(__name__)
WSDL_URL = os.getenv("PACKETA_WSDL_URL", "https://www.zasilkovna.cz/api/soap.wsdl")
PACKETA_API_PASSWORD = os.getenv("PACKETA_API_PASSWORD")
zeepZasClient = Client(wsdl=WSDL_URL)
class PacketaAPI:
#TODO: zeptat se jestli nepřidat další checkovací parametry ohledně zásilkovny např: blokování podle nastavení webu
# popřemýšlet, jestli api klíče nenastavit přes configurator webu
def __getattribute__(self):
if PACKETA_API_PASSWORD is None:
raise Exception("Packeta API password is not set in environment variables.")
# ---------- CREATE PACKET METHODS ----------
@@ -150,6 +156,7 @@ class PacketaAPI:
def create_shipment(self, packet_ids: list):
"""
Vytvoření zásilky (shipment) z více balíků.
packet_ids = ["1234567890", "1234567891", "1234567892"]
"""
try: