Add Alcohol schema
This commit is contained in:
parent
d1098c83a0
commit
965185ff5f
26
schemas/alcohol.py
Normal file
26
schemas/alcohol.py
Normal file
@ -0,0 +1,26 @@
|
||||
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
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user