
Features implemented: - Product management with CRUD operations - Category and supplier management - Stock movement tracking with automatic updates - Inventory reports and analytics - SQLite database with Alembic migrations - Health monitoring endpoints - CORS configuration for API access - Comprehensive API documentation - Code quality with Ruff linting and formatting The system provides a complete backend solution for small business inventory management with proper database relationships, stock tracking, and reporting capabilities.
45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
from datetime import datetime
|
|
from typing import Optional
|
|
from pydantic import BaseModel
|
|
from app.schemas.category import Category
|
|
from app.schemas.supplier import Supplier
|
|
|
|
|
|
class ProductBase(BaseModel):
|
|
name: str
|
|
sku: str
|
|
description: Optional[str] = None
|
|
price: float
|
|
cost: Optional[float] = None
|
|
quantity_in_stock: int = 0
|
|
minimum_stock_level: int = 0
|
|
category_id: Optional[int] = None
|
|
supplier_id: Optional[int] = None
|
|
|
|
|
|
class ProductCreate(ProductBase):
|
|
pass
|
|
|
|
|
|
class ProductUpdate(BaseModel):
|
|
name: Optional[str] = None
|
|
sku: Optional[str] = None
|
|
description: Optional[str] = None
|
|
price: Optional[float] = None
|
|
cost: Optional[float] = None
|
|
quantity_in_stock: Optional[int] = None
|
|
minimum_stock_level: Optional[int] = None
|
|
category_id: Optional[int] = None
|
|
supplier_id: Optional[int] = None
|
|
|
|
|
|
class Product(ProductBase):
|
|
id: int
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
category: Optional[Category] = None
|
|
supplier: Optional[Supplier] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|