Automated Action 3acdc84e45 Implement ToDo application with FastAPI and SQLite
- Create project structure and configuration files
- Set up database models and schemas for ToDo items
- Implement CRUD operations for ToDo management
- Create API endpoints for ToDo operations
- Add health check endpoint
- Set up Alembic for database migrations
- Add comprehensive README documentation
2025-05-18 16:45:51 +00:00
2025-05-18 16:41:56 +00:00

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:

pip install -r requirements.txt
  1. Run database migrations:
alembic upgrade head

Running the application

Start the application:

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:
      {
        "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:
      {
        "title": "string", 
        "description": "string", 
        "completed": true
      }
      
  • DELETE /api/todos/{todo_id}: Delete a todo

Health Check

  • GET /health: Check application health
    • Response:
      {
        "status": "OK", 
        "database_connected": true
      }
      

Development

Database Migrations

Create a new migration:

alembic revision -m "description"

Apply migrations:

alembic upgrade head

Rollback migration:

alembic downgrade -1
Description
Project: Todo Application
Readme 39 KiB
Languages
Python 95.6%
Mako 4.4%