diff --git a/schemas/food.py b/schemas/food.py new file mode 100644 index 0000000..b333a87 --- /dev/null +++ b/schemas/food.py @@ -0,0 +1,31 @@ +from pydantic import BaseModel, Field +from typing import Optional +from uuid import UUID + +class FoodBase(BaseModel): + 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_id: UUID = Field(..., description="ID of the category the food item belongs to") + +class FoodCreate(FoodBase): + pass + +class FoodResponse(FoodBase): + id: UUID + name: str + description: Optional[str] + price: float + category_id: UUID + + class Config: + orm_mode = True + schema_extra = { + "example": { + "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + "name": "Pizza Margherita", + "description": "Classic Italian pizza with tomato sauce and mozzarella cheese", + "price": 12.99, + "category_id": "c6fc032f-d8c9-4b9b-8e3f-a1d0011e7c3c" + } + } \ No newline at end of file