Automated Action d20c3af0bc Build a simple Todo app with FastAPI
- Setup project structure with FastAPI, SQLAlchemy, and SQLite
- Create Todo model and database migrations
- Implement CRUD API endpoints
- Add error handling and validation
- Update README with documentation and examples

generated with BackendIM... (backend.im)
2025-05-15 22:01:40 +00:00

14 lines
513 B
Python

from sqlalchemy import Column, Integer, String, Boolean, DateTime
from sqlalchemy.sql import func
from app.db.session 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())