from pydantic import BaseModel, Field | |
class MealBase(BaseModel): | |
name: str | |
description: str | |
price: float = Field(..., gt=0, description="Price must be greater than zero") | |
class MealCreate(MealBase): | |
pass | |
class MealUpdate(MealBase): | |
pass | |
class Meal(MealBase): | |
id: int | |
class Config: | |
orm_mode = True | |
class OrderBase(BaseModel): | |
quantity: int = Field(..., gt=0, description="Quantity must be greater than zero") | |
class OrderCreate(OrderBase): | |
meal_id: int | |
class Order(OrderBase): | |
id: int | |
user_id: int | |
meal_id: int | |
class Config: | |
orm_mode = True | |
class Recommendation(BaseModel): | |
meal_id: int | |
name: str | |
description: str | |
price: float | |
score: float | |
class Config: | |
orm_mode = True |