
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.
27 lines
580 B
Python
27 lines
580 B
Python
from datetime import datetime
|
|
from typing import Optional
|
|
from pydantic import BaseModel
|
|
from app.models.stock_movement import MovementType
|
|
from app.schemas.product import Product
|
|
|
|
|
|
class StockMovementBase(BaseModel):
|
|
product_id: int
|
|
movement_type: MovementType
|
|
quantity: int
|
|
reference: Optional[str] = None
|
|
notes: Optional[str] = None
|
|
|
|
|
|
class StockMovementCreate(StockMovementBase):
|
|
pass
|
|
|
|
|
|
class StockMovement(StockMovementBase):
|
|
id: int
|
|
created_at: datetime
|
|
product: Optional[Product] = None
|
|
|
|
class Config:
|
|
from_attributes = True
|