From 0d925351fa068b52986449d10c84dbd6e371c813 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Thu, 27 Mar 2025 12:19:27 +0100 Subject: [PATCH] Add Meal schema --- schemas/meal.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 schemas/meal.py diff --git a/schemas/meal.py b/schemas/meal.py new file mode 100644 index 0000000..885d793 --- /dev/null +++ b/schemas/meal.py @@ -0,0 +1,27 @@ +from pydantic import BaseModel, Field +from typing import Optional + +# Base schema +class MealBase(BaseModel): + name: str = Field(..., index=True, description="Name of the meal") + description: Optional[str] = Field(None, description="Description of the meal") + price: float = Field(..., description="Price of the meal") + category: Optional[str] = Field(None, index=True, description="Category of the meal") + is_available: bool = Field(True, description="Availability status of the meal") + +# Create schema +class MealCreate(MealBase): + pass + +# Response schema +class Meal(MealBase): + class Config: + schema_extra = { + "example": { + "name": "Margherita Pizza", + "description": "Classic Italian pizza with tomato sauce, mozzarella, and basil", + "price": 9.99, + "category": "Pizza", + "is_available": True + } + } \ No newline at end of file