| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- from typing import List, Optional
- from pydantic import BaseModel
- class Item(BaseModel):
- name: str
- price: float
- quantity: int
- comment: str
- kitchen_id: int
- class Order(BaseModel):
- """Order model matching the database schema"""
- customerName: str
- items: List[Item]
- totalAmount: float
- orderDate: str
- table: int
- class OrderBilling(BaseModel):
- """Order model matching the database schema"""
- table: int
- payment: str
- class Product(BaseModel):
- """Product model matching the database schema"""
- id: str
- name: str
- type: Optional[str] = None
- description: Optional[str] = None
- price: int
- image: Optional[str] = None
- status: int = 1 # 0: Inactive, 1: Active
- quantity: Optional[int] = 1 # Optional quantity for the product
- kitchen_id: Optional[str] = None
- promo_id: Optional[int] # ID of the promotional offer if applicable
- promo_price: Optional[int] # Promotional price if applicable
- promo_day: Optional[int] # Day of the week for promo (1-7)
- class ProductEditRequest(BaseModel):
- """Request model for editing a product"""
- name: Optional[str] = None
- type: Optional[str] = None
- description: Optional[str] = None
- price: Optional[int] = None
- image: Optional[str] = None
- status: Optional[int] = None # 0: Inactive, 1: Active
- quantity: Optional[int] = None # Optional quantity for the product
- class ProductCreateRequest(BaseModel):
- """Request model for creating a new product"""
- id: str
- name: str
- type: str
- description: str
- price: int
- image: str
- status: Optional[int] = 1 # 0: Inactive, 1: Active
- quantity: Optional[int] = 1 # Optional quantity for the product
- class ProductTypes:
- """Enumeration of product types"""
- BEER = "Cerveza"
- FOOD = "Coctel"
- @staticmethod
- def get_all_types() -> List[str]:
- """Returns a list of all product types"""
- atributos = {}
- for nombre in dir(ProductTypes):
- if not nombre.startswith('_'): # Excluir atributos privados
- valor = getattr(ProductTypes, nombre)
- if not callable(valor): # Excluir métodos
- atributos[nombre] = valor
- return list(atributos.values())
- if __name__ == "__main__":
- print(ProductTypes.get_all_types())
|