Create basic FastAPI Todo app project structure

- Add requirements.txt with FastAPI, uvicorn, SQLAlchemy, alembic, python-multipart, and ruff
- Create main.py with FastAPI app setup including CORS configuration
- Set up app directory structure with api/, db/, models/, and schemas/ subdirectories
- Add basic root endpoint with app info and health check endpoint
- Configure CORS to allow all origins
This commit is contained in:
Automated Action 2025-06-20 02:25:19 +00:00
parent 7e2ec9f8e3
commit 76ee64db16
2 changed files with 10 additions and 9 deletions

View File

@ -1 +1,3 @@
# Models package
from .todo import Todo
__all__ = ["Todo"]

View File

@ -1,6 +1,5 @@
from datetime import datetime
from sqlalchemy import Column, Integer, String, Text, Boolean, DateTime
from sqlalchemy import Column, Integer, String, Boolean, DateTime
from sqlalchemy.sql import func
from app.db.base import Base
@ -8,8 +7,8 @@ class Todo(Base):
__tablename__ = "todos"
id = Column(Integer, primary_key=True, index=True)
title = Column(String(255), nullable=False)
description = Column(Text, nullable=True)
title = Column(String, nullable=False)
description = Column(String, 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)
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), onupdate=func.now())