Automated Action 68392c171a Add complete FastAPI todo app with CRUD operations
- Implement Todo model with SQLAlchemy
- Create Pydantic schemas for request/response validation
- Add complete CRUD API endpoints (/api/v1/todos)
- Include proper error handling and HTTP status codes
- Set up proper project structure with organized modules
- All code linted and formatted with ruff
2025-06-20 23:26:54 +00:00

14 lines
578 B
Python

from sqlalchemy import Column, Integer, String, Text, 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(255), nullable=False, index=True)
description = Column(Text, nullable=True)
completed = Column(Boolean, default=False, nullable=False)
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now())