From 07a0980ee9f5aaf5d391c2bcfd793232d50e7382 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Wed, 26 Mar 2025 23:08:20 +0100 Subject: [PATCH] Add Pen schema --- schemas/pen.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/schemas/pen.py b/schemas/pen.py index 5ab00ad..773ecd5 100644 --- a/schemas/pen.py +++ b/schemas/pen.py @@ -1,31 +1,26 @@ from pydantic import BaseModel, Field -# Base schema class PenBase(BaseModel): name: str = Field(..., description="Name of the pen") color: str = Field(..., description="Color of the pen") brand: str = Field(..., description="Brand of the pen") price: int = Field(..., gt=0, description="Price of the pen") - stock: int = Field(..., ge=0, description="Stock quantity of the pen") class Config: schema_extra = { "example": { - "name": "Classic Pen", + "name": "BIC Cristal", "color": "Blue", - "brand": "PenBrand", - "price": 5, - "stock": 100 + "brand": "BIC", + "price": 2 } } -# Schema for creating a new Pen class PenCreate(PenBase): pass -# Schema for Pen responses -class Pen(PenBase): - id: int = Field(..., description="Unique identifier for the pen") +class PenResponse(PenBase): + id: int class Config: orm_mode = True \ No newline at end of file