Automated Action 10172c55ca Implement comprehensive Task Manager API with FastAPI
Added complete task management functionality including:
- CRUD operations for tasks (create, read, update, delete)
- Task model with status (pending/in_progress/completed) and priority (low/medium/high)
- SQLite database with SQLAlchemy ORM
- Alembic migrations for database schema
- Pydantic schemas for request/response validation
- FastAPI routers with proper error handling
- Filtering and pagination support
- Health check endpoint
- CORS configuration
- Comprehensive API documentation
- Proper project structure following FastAPI best practices
2025-06-20 19:34:58 +00:00

43 lines
1.0 KiB
Python

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.routers.tasks import router as tasks_router
from app.db.session import engine
from app.db.base import Base
Base.metadata.create_all(bind=engine)
app = FastAPI(
title="Task Manager API",
description="A simple task management API built with FastAPI",
version="1.0.0",
docs_url="/docs",
redoc_url="/redoc",
openapi_url="/openapi.json",
)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(tasks_router, prefix="/api/v1")
@app.get("/")
def root():
return {
"title": "Task Manager API",
"description": "A simple task management API built with FastAPI",
"version": "1.0.0",
"documentation": "/docs",
"health_check": "/health",
}
@app.get("/health")
def health_check():
return {"status": "healthy", "service": "Task Manager API", "version": "1.0.0"}