Automated Action 5f63459832 Add priority feature for todos
- Add priority field to Todo model
- Update Pydantic schemas with priority field
- Create Alembic migration for priority column
- Add filter by priority to GET /todos endpoint
- Update README with new feature details

generated with BackendIM... (backend.im)
2025-05-13 06:28:44 +00:00
2025-05-13 06:28:44 +00:00
2025-05-13 06:28:44 +00:00
2025-05-13 06:28:44 +00:00

Simple Todo Application

A simple Todo API application built with FastAPI and SQLite.

Features

  • RESTful API for managing todo items
  • SQLite database with SQLAlchemy ORM
  • Alembic migrations for database versioning
  • Priority levels for todo items (Low, Medium, High)
  • Filter todos by priority
  • Health check endpoint
  • Swagger UI documentation

Project Structure

.
├── alembic.ini
├── app
│   ├── api
│   │   └── routes
│   │       ├── health.py
│   │       └── todos.py
│   ├── db
│   │   ├── database.py
│   │   └── init_db.py
│   ├── models
│   │   └── todo.py
│   └── schemas
│       └── todo.py
├── main.py
├── migrations
│   ├── README
│   ├── env.py
│   ├── script.py.mako
│   └── versions
│       └── initial_migration.py
└── requirements.txt

Installation

  1. Clone the repository
  2. Install the dependencies:
pip install -r requirements.txt

Running the Application

uvicorn main:app --reload

The application will be available at http://localhost:8000.

API Documentation is available at:

API Endpoints

Health Check

  • GET /health - Check API health

Todo Operations

  • GET /todos - List all todos
    • Optional query parameter: priority (1=Low, 2=Medium, 3=High) to filter by priority
  • POST /todos - Create a new todo (with optional priority field: 1=Low, 2=Medium, 3=High)
  • GET /todos/{todo_id} - Get a specific todo
  • PUT /todos/{todo_id} - Update a todo (including priority)
  • DELETE /todos/{todo_id} - Delete a todo

Database

The application uses SQLite with SQLAlchemy ORM. The database file is stored at /app/storage/db/db.sqlite.

Migrations

This project uses Alembic for database migrations. To run migrations:

alembic upgrade head
Description
Project: Simple Todo Application
Readme 39 KiB
Languages
Python 94.9%
Mako 5.1%