
- Set up FastAPI project structure - Configure SQLite database with SQLAlchemy - Create Item model and schemas - Implement CRUD endpoints for inventory items - Set up Alembic for database migrations - Add comprehensive documentation
14 lines
544 B
Python
14 lines
544 B
Python
from sqlalchemy import Column, Integer, String, Float, DateTime, func
|
|
from app.db.base import Base
|
|
|
|
class Item(Base):
|
|
__tablename__ = "items"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
name = Column(String, index=True)
|
|
description = Column(String, nullable=True)
|
|
quantity = Column(Integer, default=0)
|
|
price = Column(Float, nullable=True)
|
|
category = Column(String, nullable=True)
|
|
created_at = Column(DateTime, default=func.now())
|
|
updated_at = Column(DateTime, default=func.now(), onupdate=func.now()) |