Automated Action 16000f8745 Set up database layer for todo app
- Created app/db/base.py with SQLAlchemy Base to avoid circular imports
- Created app/db/session.py with SQLite database connection using /app/storage/db path
- Created app/models/todo.py with Todo model including all required fields
- Created app/schemas/todo.py with Pydantic schemas for request/response
- Added requirements.txt with FastAPI, SQLAlchemy, and other dependencies
- Created proper package structure with __init__.py files
2025-06-20 23:17:54 +00:00

14 lines
579 B
Python

from datetime import datetime
from sqlalchemy import Column, Integer, String, Text, Boolean, DateTime
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, default=datetime.utcnow, nullable=False)
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)