Phase 1: scaffold local backend — models, schemas, routers, printer service, Docker

This commit is contained in:
2026-04-20 11:22:55 +03:00
commit 4ffe27df95
44 changed files with 2729 additions and 0 deletions

View File

@@ -0,0 +1,84 @@
from pydantic import BaseModel
from typing import Optional, List
class CategoryBase(BaseModel):
name: str
color: Optional[str] = None
sort_order: int = 0
class CategoryCreate(CategoryBase):
pass
class CategoryUpdate(BaseModel):
name: Optional[str] = None
color: Optional[str] = None
sort_order: Optional[int] = None
class CategoryOut(CategoryBase):
id: int
model_config = {"from_attributes": True}
class ProductOptionBase(BaseModel):
name: str
extra_cost: float = 0.0
class ProductOptionCreate(ProductOptionBase):
pass
class ProductOptionOut(ProductOptionBase):
id: int
product_id: int
model_config = {"from_attributes": True}
class ProductIngredientBase(BaseModel):
name: str
class ProductIngredientCreate(ProductIngredientBase):
pass
class ProductIngredientOut(ProductIngredientBase):
id: int
product_id: int
model_config = {"from_attributes": True}
class ProductBase(BaseModel):
name: str
category_id: Optional[int] = None
base_price: float
is_available: bool = True
printer_zone_id: Optional[int] = None
class ProductCreate(ProductBase):
options: List[ProductOptionCreate] = []
ingredients: List[ProductIngredientCreate] = []
class ProductUpdate(BaseModel):
name: Optional[str] = None
category_id: Optional[int] = None
base_price: Optional[float] = None
is_available: Optional[bool] = None
printer_zone_id: Optional[int] = None
class ProductOut(ProductBase):
id: int
options: List[ProductOptionOut] = []
ingredients: List[ProductIngredientOut] = []
model_config = {"from_attributes": True}