From 965185ff5f973b15fb8cd579d93be76f3073dcac Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Tue, 25 Mar 2025 14:44:33 -0500 Subject: [PATCH] Add Alcohol schema --- schemas/alcohol.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 schemas/alcohol.py diff --git a/schemas/alcohol.py b/schemas/alcohol.py new file mode 100644 index 0000000..6490c73 --- /dev/null +++ b/schemas/alcohol.py @@ -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 + } + } \ No newline at end of file