18 lines
584 B
Python
18 lines
584 B
Python
from pydantic import BaseModel, Field
|
|
from typing import Optional
|
|
from uuid import UUID
|
|
|
|
class MealBase(BaseModel):
|
|
name: str = Field(..., description="Name of the meal")
|
|
description: Optional[str] = Field(None, description="Description of the meal")
|
|
price: float = Field(..., gt=0, description="Price of the meal")
|
|
category_id: UUID = Field(..., description="ID of the category the meal belongs to")
|
|
|
|
class MealCreate(MealBase):
|
|
pass
|
|
|
|
class MealResponse(MealBase):
|
|
id: UUID = Field(..., description="ID of the meal")
|
|
|
|
class Config:
|
|
orm_mode = True |