Unification of pagination, admins control and more

This commit is contained in:
2026-03-02 19:02:20 +07:00
parent 035170e46f
commit eab67ccfc1
13 changed files with 271 additions and 118 deletions

View File

@@ -1,3 +1,12 @@
from .cart import CartItemDTO
from .control import EditProductContext
from .checkout import CheckoutContext
from .catalogue import CatalogueView, CatalogueType
__all__ = ["CartItemDTO"]
__all__ = [
"CartItemDTO",
"EditProductContext",
"CheckoutContext",
"CatalogueView",
"CatalogueType",
]

24
dto/catalogue.py Normal file
View File

@@ -0,0 +1,24 @@
from dataclasses import dataclass
from enum import Enum
from typing import Optional, Union
from db.models import Category
from db.models.products import Product
class CatalogueType(Enum):
CATEGORIES = "categories"
PRODUCTS = "products"
EMPTY = "empty"
@dataclass
class CatalogueView:
view_type: Optional[CatalogueType] = None
category: Optional[Category] = None
children: Optional[list[Category]] = None
products: Optional[list[Product]] = None
page: int = 0
parent_id: Union[int, str, None] = None
has_next: bool = False
show_menu: bool = False