diff --git a/schemas/food.py b/schemas/food.py index eab89ea..9ceffda 100644 --- a/schemas/food.py +++ b/schemas/food.py @@ -1,34 +1,28 @@ -from pydantic import BaseModel, Field, constr -from typing import Optional -from enum import Enum - -class FoodCategory(str, Enum): - APPETIZER = "appetizer" - MAIN_COURSE = "main_course" - DESSERT = "dessert" - BEVERAGE = "beverage" +from pydantic import BaseModel, Field +from typing import Optional, Union class FoodBase(BaseModel): - name: constr(min_length=1, max_length=100) = Field(..., description="Name of the food item") + name: str = Field(..., description="Name of the food item") description: Optional[str] = Field(None, description="Description of the food item") price: float = Field(..., gt=0, description="Price of the food item") - category: FoodCategory = Field(..., description="Category of the food item") + is_available: bool = Field(True, description="Availability status of the food item") + category: Optional[str] = Field(None, description="Category of the food item") + cuisine: Optional[str] = Field(None, description="Cuisine of the food item") + allergens: Optional[Union[list, dict]] = Field(None, description="Allergens present in the food item") class FoodCreate(FoodBase): pass class FoodResponse(FoodBase): - id: int = Field(..., description="Unique identifier for the food item") - is_available: bool = Field(True, description="Availability status of the food item") - class Config: schema_extra = { "example": { - "id": 1, "name": "Margherita Pizza", - "description": "Classic Italian pizza with tomato sauce, mozzarella, and fresh basil", + "description": "Classic Italian pizza with tomato sauce, mozzarella cheese, and fresh basil", "price": 12.99, - "category": "main_course", - "is_available": True + "is_available": True, + "category": "Pizza", + "cuisine": "Italian", + "allergens": ["dairy", "wheat"] } } \ No newline at end of file