
- Add project structure with FastAPI, SQLAlchemy, and Alembic - Implement Todo model with CRUD operations - Add REST API endpoints for todo management - Configure SQLite database with migrations - Include health check and API documentation endpoints - Add CORS middleware for all origins - Format code with Ruff
16 lines
526 B
Python
16 lines
526 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(200), nullable=False)
|
|
description = Column(String(500), 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())
|