items.py 450 B

123456789101112131415161718
  1. from typing import List, Optional
  2. from pydantic import BaseModel
  3. class Product(BaseModel):
  4. """Product model matching the database schema"""
  5. id: int
  6. name: str
  7. type: Optional[str] = None
  8. description: Optional[str] = None
  9. price: float
  10. image: Optional[str] = None
  11. status: int = 1 # 0: Inactive, 1: Active
  12. class ProductWithQuantity(Product):
  13. """Product model with quantity field for sales"""
  14. cantidad: int = 1