From b938114f33892bb127f08afdebdc8598b17f42bb Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Fri, 28 Mar 2025 16:01:01 +0000 Subject: [PATCH] Add Food schema --- schemas/food.py | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/schemas/food.py b/schemas/food.py index 3cd212f..46248de 100644 --- a/schemas/food.py +++ b/schemas/food.py @@ -1,38 +1,18 @@ from pydantic import BaseModel, Field -from typing import Optional from uuid import UUID -# Base schema 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 food category") + address: str = Field(..., description="Address of the restaurant") + description: str | None = Field(None, description="Description of the food item") + price: float = Field(..., description="Price of the food item") + restaurant_id: UUID = Field(..., description="ID of the restaurant") -# Schema for creating a new Food class FoodCreate(FoodBase): - class Config: - schema_extra = { - "example": { - "name": "Pizza Margherita", - "description": "Classic Italian pizza with tomato sauce, mozzarella, and basil", - "price": 12.99, - "category_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6" - } - } + pass -# Schema for Food responses -class Food(FoodBase): - id: UUID +class FoodResponse(FoodBase): + id: UUID = Field(..., description="ID of the food item") class Config: - orm_mode = True - schema_extra = { - "example": { - "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", - "name": "Pizza Margherita", - "description": "Classic Italian pizza with tomato sauce, mozzarella, and basil", - "price": 12.99, - "category_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6" - } - } \ No newline at end of file + orm_mode = True \ No newline at end of file