
- Created FastAPI application structure with SQLAlchemy and Alembic - Implemented full CRUD operations for inventory items - Added search, filtering, and pagination capabilities - Configured CORS, API documentation, and health endpoints - Set up SQLite database with proper migrations - Added comprehensive API documentation and README
19 lines
864 B
Python
19 lines
864 B
Python
from sqlalchemy import Column, Integer, String, Float, DateTime, Text
|
|
from sqlalchemy.sql import func
|
|
from app.db.base import Base
|
|
|
|
|
|
class InventoryItem(Base):
|
|
__tablename__ = "inventory_items"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
name = Column(String(255), nullable=False, index=True)
|
|
description = Column(Text, nullable=True)
|
|
sku = Column(String(100), unique=True, nullable=False, index=True)
|
|
quantity = Column(Integer, nullable=False, default=0)
|
|
price = Column(Float, nullable=False)
|
|
category = Column(String(100), nullable=True, index=True)
|
|
supplier = Column(String(255), nullable=True)
|
|
location = Column(String(255), nullable=True)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now()) |