
- Set up FastAPI application with CORS support - Implement SQLAlchemy models and database session management - Create CRUD API endpoints for items management - Configure Alembic for database migrations - Add health check and service info endpoints - Include comprehensive documentation and project structure - Integrate Ruff for code quality and formatting
13 lines
523 B
Python
13 lines
523 B
Python
from sqlalchemy import Column, Integer, String, Boolean, DateTime
|
|
from sqlalchemy.sql import 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, nullable=False)
|
|
description = Column(String, nullable=True)
|
|
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()) |