# Task Manager API A comprehensive task management API built with FastAPI, SQLAlchemy, and SQLite. This API provides full CRUD operations for managing tasks with status tracking, priority levels, and timestamps. ## Features - ✅ Create, read, update, and delete tasks - ✅ Task status management (pending, in_progress, completed) - ✅ Priority levels (low, medium, high) - ✅ Automatic timestamps (created_at, updated_at) - ✅ Filtering by status and priority - ✅ Pagination support - ✅ FastAPI automatic documentation - ✅ SQLite database with SQLAlchemy ORM - ✅ Database migrations with Alembic - ✅ CORS enabled for cross-origin requests - ✅ Health check endpoint ## API Endpoints ### Base URL - **GET** `/` - API information and links - **GET** `/health` - Health check endpoint ### Tasks - **POST** `/api/v1/tasks/` - Create a new task - **GET** `/api/v1/tasks/` - Get all tasks (with optional filtering and pagination) - **GET** `/api/v1/tasks/{task_id}` - Get a specific task by ID - **PUT** `/api/v1/tasks/{task_id}` - Update a specific task - **DELETE** `/api/v1/tasks/{task_id}` - Delete a specific task ### Query Parameters for GET /api/v1/tasks/ - `skip` (int): Number of tasks to skip (default: 0) - `limit` (int): Maximum number of tasks to return (default: 100, max: 1000) - `status` (string): Filter by status (`pending`, `in_progress`, `completed`) - `priority` (string): Filter by priority (`low`, `medium`, `high`) ## Task Schema ```json { "id": 1, "title": "Example Task", "description": "This is an example task description", "status": "pending", "priority": "medium", "created_at": "2025-06-20T12:00:00", "updated_at": "2025-06-20T12:00:00" } ``` ### Status Values - `pending` - Task is not yet started - `in_progress` - Task is currently being worked on - `completed` - Task has been finished ### Priority Values - `low` - Low priority task - `medium` - Medium priority task (default) - `high` - High priority task ## Installation and Setup 1. Install dependencies: ```bash pip install -r requirements.txt ``` 2. Run database migrations: ```bash alembic upgrade head ``` 3. Start the development server: ```bash uvicorn main:app --reload ``` The API will be available at `http://localhost:8000` ## Documentation - **Swagger UI**: http://localhost:8000/docs - **ReDoc**: http://localhost:8000/redoc - **OpenAPI JSON**: http://localhost:8000/openapi.json ## Environment Variables No environment variables are required for basic operation. The application uses SQLite with a local database file stored in `/app/storage/db/db.sqlite`. ## Development The application uses the following structure: - `main.py` - FastAPI application entry point - `app/models/` - SQLAlchemy database models - `app/schemas/` - Pydantic request/response schemas - `app/crud/` - Database operations - `app/routers/` - API route handlers - `app/db/` - Database configuration and session management - `alembic/` - Database migration files ## Testing Run the linter and formatter: ```bash ruff check . ruff format . ``` ## Production Deployment For production deployment, ensure proper database configuration and consider using PostgreSQL instead of SQLite for better performance and concurrent access.