diff --git a/schemas/shoe.py b/schemas/shoe.py new file mode 100644 index 0000000..9017757 --- /dev/null +++ b/schemas/shoe.py @@ -0,0 +1,56 @@ +from pydantic import BaseModel, Field +from typing import Optional +from datetime import datetime + +class ShoeBase(BaseModel): + name: str = Field(..., index=True, min_length=1, max_length=100) + brand: str = Field(..., min_length=1, max_length=50) + size: int = Field(..., gt=0, lt=50) + color: str = Field(..., min_length=1, max_length=30) + style: Optional[str] = Field(None, max_length=50) + condition: Optional[str] = Field(None, max_length=50) + price: Optional[int] = Field(None, gt=0) + notes: Optional[str] = Field(None, max_length=500) + +class ShoeCreate(ShoeBase): + purchase_date: Optional[datetime] = None + + class Config: + schema_extra = { + "example": { + "name": "Air Max 90", + "brand": "Nike", + "size": 42, + "color": "White", + "style": "Sneaker", + "condition": "New", + "purchase_date": "2023-01-01T00:00:00", + "price": 129, + "notes": "Limited edition colorway" + } + } + +class Shoe(ShoeBase): + id: int + purchase_date: Optional[datetime] + created_at: datetime + updated_at: datetime + + class Config: + orm_mode = True + schema_extra = { + "example": { + "id": 1, + "name": "Air Max 90", + "brand": "Nike", + "size": 42, + "color": "White", + "style": "Sneaker", + "condition": "New", + "purchase_date": "2023-01-01T00:00:00", + "price": 129, + "notes": "Limited edition colorway", + "created_at": "2023-01-01T00:00:00", + "updated_at": "2023-01-01T00:00:00" + } + } \ No newline at end of file