Automated Action a17fe518a9 Implement Small Business Inventory Management System
This commit includes:
- Project structure setup with FastAPI and SQLite
- Database models and schemas for inventory management
- CRUD operations for all entities
- API endpoints for product, category, supplier, and inventory management
- User authentication with JWT tokens
- Initial database migration
- Comprehensive README with setup instructions
2025-06-17 19:02:35 +00:00

30 lines
1.2 KiB
Python

from sqlalchemy import Column, String, Text, Integer, Float, ForeignKey, Boolean
from sqlalchemy.orm import relationship
from app.db.base_class import BaseClass
from app.db.base import Base
class Product(Base, BaseClass):
"""
Product model for inventory items.
"""
name = Column(String(255), index=True, nullable=False)
description = Column(Text, nullable=True)
sku = Column(String(50), unique=True, index=True, nullable=False)
barcode = Column(String(100), unique=True, index=True, nullable=True)
price = Column(Float, nullable=False, default=0.0)
cost = Column(Float, nullable=False, default=0.0)
# Stock management
min_stock_level = Column(Integer, nullable=False, default=0)
is_active = Column(Boolean, default=True)
# Foreign keys
category_id = Column(Integer, ForeignKey("category.id"), nullable=True)
supplier_id = Column(Integer, ForeignKey("supplier.id"), nullable=True)
# Relationships
category = relationship("Category", back_populates="products")
supplier = relationship("Supplier", back_populates="products")
inventory_items = relationship("Inventory", back_populates="product")