
- Set up project structure - Create FastAPI app with health endpoint - Implement SQLAlchemy with SQLite database - Set up Alembic for database migrations - Create CRUD operations for items - Add comprehensive documentation
16 lines
543 B
Python
16 lines
543 B
Python
from sqlalchemy import Column, Integer, String, Boolean, DateTime
|
|
from sqlalchemy.sql import func
|
|
from app.db.session import Base
|
|
|
|
|
|
class Item(Base):
|
|
__tablename__ = "items"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
name = Column(String, index=True)
|
|
description = Column(String)
|
|
price = Column(Integer) # Price in cents
|
|
is_active = Column(Boolean, default=True)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|