
- Set up FastAPI project structure with proper organization - Create Todo model with SQLAlchemy ORM - Set up Alembic for database migrations - Create CRUD operations and API endpoints for todos - Add health check endpoint - Update README with comprehensive documentation generated with BackendIM... (backend.im)
14 lines
510 B
Python
14 lines
510 B
Python
from sqlalchemy import Column, Integer, String, Boolean, DateTime
|
|
from sqlalchemy.sql import func
|
|
|
|
from app.db.base import Base
|
|
|
|
class Todo(Base):
|
|
__tablename__ = "todos"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
title = Column(String, index=True)
|
|
description = Column(String, nullable=True)
|
|
completed = Column(Boolean, default=False)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), onupdate=func.now()) |