
- Set up project structure with FastAPI and SQLite - Created database models for users, categories, suppliers, items, and stock transactions - Implemented Alembic for database migrations with proper absolute paths - Built comprehensive CRUD operations for all entities - Added JWT-based authentication and authorization system - Created RESTful API endpoints for all inventory operations - Implemented search, filtering, and low stock alerts - Added health check endpoint and base URL response - Configured CORS for all origins - Set up Ruff for code linting and formatting - Updated README with comprehensive documentation and usage examples The system provides complete inventory management functionality for small businesses including product tracking, supplier management, stock transactions, and reporting. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
65 lines
1.6 KiB
Python
65 lines
1.6 KiB
Python
from pydantic import BaseModel
|
|
from datetime import datetime
|
|
from typing import Optional
|
|
from app.schemas.category import Category
|
|
from app.schemas.supplier import Supplier
|
|
|
|
|
|
class ItemBase(BaseModel):
|
|
name: str
|
|
description: Optional[str] = None
|
|
sku: str
|
|
barcode: Optional[str] = None
|
|
unit_price: float
|
|
cost_price: Optional[float] = None
|
|
quantity_in_stock: int = 0
|
|
minimum_stock_level: int = 0
|
|
maximum_stock_level: Optional[int] = None
|
|
reorder_point: int = 0
|
|
is_active: bool = True
|
|
category_id: Optional[int] = None
|
|
supplier_id: Optional[int] = None
|
|
|
|
|
|
class ItemCreate(ItemBase):
|
|
pass
|
|
|
|
|
|
class ItemUpdate(BaseModel):
|
|
name: Optional[str] = None
|
|
description: Optional[str] = None
|
|
sku: Optional[str] = None
|
|
barcode: Optional[str] = None
|
|
unit_price: Optional[float] = None
|
|
cost_price: Optional[float] = None
|
|
quantity_in_stock: Optional[int] = None
|
|
minimum_stock_level: Optional[int] = None
|
|
maximum_stock_level: Optional[int] = None
|
|
reorder_point: Optional[int] = None
|
|
is_active: Optional[bool] = None
|
|
category_id: Optional[int] = None
|
|
supplier_id: Optional[int] = None
|
|
|
|
|
|
class Item(ItemBase):
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
category: Optional[Category] = None
|
|
supplier: Optional[Supplier] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
class ItemWithLowStock(BaseModel):
|
|
id: int
|
|
name: str
|
|
sku: str
|
|
quantity_in_stock: int
|
|
minimum_stock_level: int
|
|
reorder_point: int
|
|
|
|
class Config:
|
|
from_attributes = True
|