Automated Action 667ac548e1 Build complete FastAPI inventory management application
- Created FastAPI application structure with SQLAlchemy and Alembic
- Implemented full CRUD operations for inventory items
- Added search, filtering, and pagination capabilities
- Configured CORS, API documentation, and health endpoints
- Set up SQLite database with proper migrations
- Added comprehensive API documentation and README
2025-07-21 19:29:24 +00:00

38 lines
1.2 KiB
Python

from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field
class InventoryItemBase(BaseModel):
name: str = Field(..., min_length=1, max_length=255)
description: Optional[str] = None
sku: str = Field(..., min_length=1, max_length=100)
quantity: int = Field(..., ge=0)
price: float = Field(..., gt=0)
category: Optional[str] = Field(None, max_length=100)
supplier: Optional[str] = Field(None, max_length=255)
location: Optional[str] = Field(None, max_length=255)
class InventoryItemCreate(InventoryItemBase):
pass
class InventoryItemUpdate(BaseModel):
name: Optional[str] = Field(None, min_length=1, max_length=255)
description: Optional[str] = None
sku: Optional[str] = Field(None, min_length=1, max_length=100)
quantity: Optional[int] = Field(None, ge=0)
price: Optional[float] = Field(None, gt=0)
category: Optional[str] = Field(None, max_length=100)
supplier: Optional[str] = Field(None, max_length=255)
location: Optional[str] = Field(None, max_length=255)
class InventoryItem(InventoryItemBase):
id: int
created_at: datetime
updated_at: datetime
class Config:
from_attributes = True