29 lines
818 B
Python
29 lines
818 B
Python
from pydantic import BaseModel
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
|
|
class ProductBase(BaseModel):
|
|
name: str
|
|
price_cents: int # Verkaufspreis (falls genutzt)
|
|
purchase_price_cents: int = 0 # 🆕 EK je Einheit (Cent)
|
|
pack_size: int = 1 # 🆕 6, 12, 24 ...
|
|
supplier_number: Optional[str] = None
|
|
volume_ml: Optional[int] = None
|
|
category: Optional[str] = None
|
|
stock: int = 0 # Default sinnvoller
|
|
is_active: bool = True # Default sinnvoller
|
|
|
|
class ProductCreate(ProductBase):
|
|
pass
|
|
|
|
class ProductUpdate(ProductBase):
|
|
pass
|
|
|
|
class ProductOut(ProductBase):
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|