
- 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>
41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
from sqlalchemy import (
|
|
Column,
|
|
Integer,
|
|
String,
|
|
DateTime,
|
|
Text,
|
|
Float,
|
|
ForeignKey,
|
|
Boolean,
|
|
)
|
|
from sqlalchemy.orm import relationship
|
|
from datetime import datetime
|
|
from app.db.base import Base
|
|
|
|
|
|
class Item(Base):
|
|
__tablename__ = "items"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
name = Column(String, index=True, nullable=False)
|
|
description = Column(Text)
|
|
sku = Column(String, unique=True, index=True, nullable=False)
|
|
barcode = Column(String, unique=True, index=True)
|
|
unit_price = Column(Float, nullable=False)
|
|
cost_price = Column(Float)
|
|
quantity_in_stock = Column(Integer, default=0)
|
|
minimum_stock_level = Column(Integer, default=0)
|
|
maximum_stock_level = Column(Integer)
|
|
reorder_point = Column(Integer, default=0)
|
|
is_active = Column(Boolean, default=True)
|
|
|
|
category_id = Column(Integer, ForeignKey("categories.id"))
|
|
supplier_id = Column(Integer, ForeignKey("suppliers.id"))
|
|
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
category = relationship("Category", back_populates="items")
|
|
supplier = relationship("Supplier", back_populates="items")
|
|
transactions = relationship("StockTransaction", back_populates="item")
|