Cart rendering, bug fixes with cart adding/rming

This commit is contained in:
2026-02-08 19:15:48 +07:00
parent e8a61c05b3
commit 6409d66dfd
12 changed files with 252 additions and 38 deletions

3
dto/__init__.py Normal file
View File

@@ -0,0 +1,3 @@
from .cart import CartItemDTO
__all__ = ["CartItemDTO"]

19
dto/cart.py Normal file
View File

@@ -0,0 +1,19 @@
from dataclasses import dataclass
@dataclass(frozen=True)
class CartItemDTO:
product_id: int
name: str
quantity: int
price: int
@property
def total(self):
return self.price * self.quantity
@dataclass
class CartDTO:
items: list[CartItemDTO]
total: int