|
@@ -1,6 +1,7 @@
|
|
|
from typing import List, Optional
|
|
from typing import List, Optional
|
|
|
from pydantic import BaseModel
|
|
from pydantic import BaseModel
|
|
|
|
|
|
|
|
|
|
+
|
|
|
class Item(BaseModel):
|
|
class Item(BaseModel):
|
|
|
name: str
|
|
name: str
|
|
|
price: float
|
|
price: float
|
|
@@ -8,6 +9,7 @@ class Item(BaseModel):
|
|
|
comment: str
|
|
comment: str
|
|
|
kitchen_id: int
|
|
kitchen_id: int
|
|
|
|
|
|
|
|
|
|
+
|
|
|
class Order(BaseModel):
|
|
class Order(BaseModel):
|
|
|
"""Order model matching the database schema"""
|
|
"""Order model matching the database schema"""
|
|
|
customerName: str
|
|
customerName: str
|
|
@@ -16,13 +18,16 @@ class Order(BaseModel):
|
|
|
orderDate: str
|
|
orderDate: str
|
|
|
table: int
|
|
table: int
|
|
|
|
|
|
|
|
|
|
+
|
|
|
class OrderBilling(BaseModel):
|
|
class OrderBilling(BaseModel):
|
|
|
"""Order model matching the database schema"""
|
|
"""Order model matching the database schema"""
|
|
|
table: int
|
|
table: int
|
|
|
payment: str
|
|
payment: str
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
class Product(BaseModel):
|
|
class Product(BaseModel):
|
|
|
"""Product model matching the database schema"""
|
|
"""Product model matching the database schema"""
|
|
|
- id: int
|
|
|
|
|
|
|
+ id: str
|
|
|
name: str
|
|
name: str
|
|
|
type: Optional[str] = None
|
|
type: Optional[str] = None
|
|
|
description: Optional[str] = None
|
|
description: Optional[str] = None
|
|
@@ -30,11 +35,11 @@ class Product(BaseModel):
|
|
|
image: Optional[str] = None
|
|
image: Optional[str] = None
|
|
|
status: int = 1 # 0: Inactive, 1: Active
|
|
status: int = 1 # 0: Inactive, 1: Active
|
|
|
quantity: Optional[int] = 1 # Optional quantity for the product
|
|
quantity: Optional[int] = 1 # Optional quantity for the product
|
|
|
- kitchen_id: Optional[int] = 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)
|
|
|
|
|
-
|
|
|
|
|
|
|
+ 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):
|
|
class ProductEditRequest(BaseModel):
|
|
|
"""Request model for editing a product"""
|
|
"""Request model for editing a product"""
|
|
@@ -46,9 +51,10 @@ class ProductEditRequest(BaseModel):
|
|
|
status: Optional[int] = None # 0: Inactive, 1: Active
|
|
status: Optional[int] = None # 0: Inactive, 1: Active
|
|
|
quantity: Optional[int] = None # Optional quantity for the product
|
|
quantity: Optional[int] = None # Optional quantity for the product
|
|
|
|
|
|
|
|
|
|
+
|
|
|
class ProductCreateRequest(BaseModel):
|
|
class ProductCreateRequest(BaseModel):
|
|
|
"""Request model for creating a new product"""
|
|
"""Request model for creating a new product"""
|
|
|
- id: int
|
|
|
|
|
|
|
+ id: str
|
|
|
name: str
|
|
name: str
|
|
|
type: str
|
|
type: str
|
|
|
description: str
|
|
description: str
|
|
@@ -57,6 +63,7 @@ class ProductCreateRequest(BaseModel):
|
|
|
status: Optional[int] = 1 # 0: Inactive, 1: Active
|
|
status: Optional[int] = 1 # 0: Inactive, 1: Active
|
|
|
quantity: Optional[int] = 1 # Optional quantity for the product
|
|
quantity: Optional[int] = 1 # Optional quantity for the product
|
|
|
|
|
|
|
|
|
|
+
|
|
|
class ProductTypes:
|
|
class ProductTypes:
|
|
|
"""Enumeration of product types"""
|
|
"""Enumeration of product types"""
|
|
|
BEER = "Cerveza"
|
|
BEER = "Cerveza"
|
|
@@ -67,12 +74,12 @@ class ProductTypes:
|
|
|
"""Returns a list of all product types"""
|
|
"""Returns a list of all product types"""
|
|
|
atributos = {}
|
|
atributos = {}
|
|
|
for nombre in dir(ProductTypes):
|
|
for nombre in dir(ProductTypes):
|
|
|
- if not nombre.startswith('_'): # Excluir atributos privados/especiales
|
|
|
|
|
|
|
+ if not nombre.startswith('_'): # Excluir atributos privados
|
|
|
valor = getattr(ProductTypes, nombre)
|
|
valor = getattr(ProductTypes, nombre)
|
|
|
if not callable(valor): # Excluir métodos
|
|
if not callable(valor): # Excluir métodos
|
|
|
atributos[nombre] = valor
|
|
atributos[nombre] = valor
|
|
|
return list(atributos.values())
|
|
return list(atributos.values())
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if __name__ == "__main__":
|
|
|
- print(ProductTypes.get_all_types())
|
|
|
|
|
|
|
+ print(ProductTypes.get_all_types())
|