Unification of pagination, admins control and more
This commit is contained in:
24
dto/catalogue.py
Normal file
24
dto/catalogue.py
Normal 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
|
||||
Reference in New Issue
Block a user