Automated Action 1b1f93e10f Create Todo application with FastAPI and SQLite
- Set up project structure with FastAPI
- Create Todo database model and schema
- Implement database connection with SQLAlchemy
- Set up Alembic migrations
- Implement CRUD API endpoints for Todo items
- Add health check endpoint
- Update documentation in README.md

generated with BackendIM... (backend.im)
2025-05-12 05:45:11 +00:00

16 lines
641 B
Python

from sqlalchemy import Column, Integer, String, Boolean, DateTime, func
from sqlalchemy.ext.declarative import declarative_base
from app.db.database import Base
class Todo(Base):
"""
Todo model for storing todo items in the database.
"""
__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), server_default=func.now(), onupdate=func.now())