2025-03-25 14:44:33 -05:00

26 lines
806 B
Python

from pydantic import BaseModel, Field
# Base schema
class AlcoholBase(BaseModel):
name: str = Field(..., description="Name of the alcohol")
brand: str = Field(..., description="Brand of the alcohol")
alcohol_type: str = Field(..., description="Type of alcohol (e.g., beer, wine, spirits)")
alcohol_content: int = Field(..., gt=0, description="Alcohol content in percentage")
# Schema for creating a new Alcohol
class AlcoholCreate(AlcoholBase):
pass
# Schema for Alcohol responses
class Alcohol(AlcoholBase):
id: int
class Config:
schema_extra = {
"example": {
"name": "Cabernet Sauvignon",
"brand": "Chateau Montelena",
"alcohol_type": "Wine",
"alcohol_content": 14
}
}