# ToDo Application API A simple ToDo Application API built with FastAPI and SQLite. ## Features - Create, read, update, and delete ToDo items - Filter ToDo items by completion status - Pagination support - Health check endpoint - SQLite database for data persistence - Alembic for database migrations ## Project Structure ``` . ├── alembic.ini ├── app │ ├── api │ │ ├── routes │ │ │ ├── health.py │ │ │ └── todo.py │ ├── core │ ├── crud │ │ └── todo.py │ ├── db │ │ ├── base.py │ │ └── session.py │ ├── models │ │ └── todo.py │ └── schemas │ └── todo.py ├── main.py ├── migrations │ ├── env.py │ ├── script.py.mako │ └── versions │ └── 001_create_todos_table.py └── requirements.txt ``` ## Installation 1. Clone the repository 2. Install dependencies: ```bash pip install -r requirements.txt ``` 3. Run database migrations: ```bash alembic upgrade head ``` ## Running the application Start the application: ```bash uvicorn main:app --reload ``` The API will be available at http://localhost:8000. You can access the API documentation at http://localhost:8000/docs. ## API Endpoints ### ToDo Operations - `GET /api/todos`: List all todos - Query Parameters: - `skip`: Number of items to skip (default: 0) - `limit`: Maximum number of items to return (default: 100) - `completed`: Filter by completion status (Boolean, optional) - `POST /api/todos`: Create a new todo - Request Body: ```json { "title": "string", "description": "string", "completed": false } ``` - `GET /api/todos/{todo_id}`: Get a specific todo - `PUT /api/todos/{todo_id}`: Update a todo - Request Body: ```json { "title": "string", "description": "string", "completed": true } ``` - `DELETE /api/todos/{todo_id}`: Delete a todo ### Health Check - `GET /health`: Check application health - Response: ```json { "status": "OK", "database_connected": true } ``` ## Development ### Database Migrations Create a new migration: ```bash alembic revision -m "description" ``` Apply migrations: ```bash alembic upgrade head ``` Rollback migration: ```bash alembic downgrade -1 ```