Automated Action 700da98f88 Implement small business inventory management system with FastAPI and SQLite
- Created complete RESTful API for inventory management
- Set up database models for items, categories, suppliers, and transactions
- Implemented user authentication with JWT tokens
- Added transaction tracking for inventory movements
- Created comprehensive API endpoints for all CRUD operations
- Set up Alembic for database migrations
- Added input validation and error handling
- Created detailed documentation in README
2025-06-08 10:00:50 +00:00

60 lines
1.2 KiB
Python

from datetime import datetime
from typing import Optional, TYPE_CHECKING, Any
from pydantic import BaseModel
# Import at the end to avoid circular imports
if TYPE_CHECKING:
pass
# Shared properties
class ItemBase(BaseModel):
name: str
description: Optional[str] = None
sku: str
quantity: int = 0
unit_price: float
location: Optional[str] = None
min_stock_level: Optional[int] = 0
category_id: Optional[str] = None
supplier_id: Optional[str] = None
# Properties to receive via API on creation
class ItemCreate(ItemBase):
pass
# Properties to receive via API on update
class ItemUpdate(ItemBase):
name: Optional[str] = None
sku: Optional[str] = None
quantity: Optional[int] = None
unit_price: Optional[float] = None
class ItemInDBBase(ItemBase):
id: str
created_at: datetime
updated_at: Optional[datetime] = None
class Config:
orm_mode = True
# Additional properties to return via API
class Item(ItemInDBBase):
pass
# Item with extended information
class ItemWithDetails(Item):
category: Optional[Any] = None
supplier: Optional[Any] = None
# Update forward refs after imports
ItemWithDetails.update_forward_refs()