
Features include: - User management with JWT authentication and role-based access - Inventory items with SKU/barcode tracking and stock management - Categories and suppliers organization - Inventory transactions with automatic stock updates - Low stock alerts and advanced search/filtering - RESTful API with comprehensive CRUD operations - SQLite database with Alembic migrations - Auto-generated API documentation Co-Authored-By: Claude <noreply@anthropic.com>
45 lines
1.3 KiB
Python
45 lines
1.3 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 InventoryItemBase(BaseModel):
|
|
name: str
|
|
description: Optional[str] = None
|
|
sku: str
|
|
barcode: Optional[str] = None
|
|
cost_price: float = 0.0
|
|
selling_price: float = 0.0
|
|
quantity_in_stock: int = 0
|
|
minimum_stock_level: int = 0
|
|
maximum_stock_level: Optional[int] = None
|
|
category_id: Optional[int] = None
|
|
supplier_id: Optional[int] = None
|
|
|
|
class InventoryItemCreate(InventoryItemBase):
|
|
pass
|
|
|
|
class InventoryItemUpdate(BaseModel):
|
|
name: Optional[str] = None
|
|
description: Optional[str] = None
|
|
sku: Optional[str] = None
|
|
barcode: Optional[str] = None
|
|
cost_price: Optional[float] = None
|
|
selling_price: Optional[float] = None
|
|
quantity_in_stock: Optional[int] = None
|
|
minimum_stock_level: Optional[int] = None
|
|
maximum_stock_level: Optional[int] = None
|
|
category_id: Optional[int] = None
|
|
supplier_id: Optional[int] = None
|
|
|
|
class InventoryItem(InventoryItemBase):
|
|
id: int
|
|
is_low_stock: bool
|
|
created_at: datetime
|
|
updated_at: Optional[datetime] = None
|
|
category: Optional[Category] = None
|
|
supplier: Optional[Supplier] = None
|
|
|
|
class Config:
|
|
from_attributes = True |