
- Added priority (low, medium, high) to todo items - Added due date to todo items - Enhanced API to support filtering by priority and due date - Added overdue and due_soon filters for better task management - Automatic sorting by priority and due date - Created alembic migration for the new fields - Updated documentation generated with BackendIM... (backend.im)
Todo Application
A simple Todo application built with FastAPI and SQLite.
Features
- Create, read, update, and delete todos
- Assign priority levels (low, medium, high) to todos
- Set due dates for todos
- Filter todos by completion status, priority, and due dates
- Find overdue and soon-to-be-due todos
- Automatic sorting by priority and due date
- Health endpoint for application monitoring
Project Structure
/
├── app/
│ ├── api/
│ │ ├── endpoints/
│ │ │ ├── health.py # Health check endpoint
│ │ │ └── todos.py # Todo CRUD operations
│ ├── db/
│ │ ├── base.py # SQLAlchemy Base
│ │ └── session.py # Database session management
│ ├── models/
│ │ └── todo.py # SQLAlchemy Todo model
│ └── schemas/
│ └── todo.py # Pydantic schemas for Todo
├── alembic/ # Database migrations
├── main.py # FastAPI application
└── requirements.txt # Project dependencies
Setup
- Install dependencies:
pip install -r requirements.txt
- Run migrations:
alembic upgrade head
- Start the application:
uvicorn main:app --reload
API Endpoints
Todos
GET /api/todos
: List all todos- Query parameters:
completed
: Filter by completion status (boolean)priority
: Filter by priority level (low, medium, high)due_date_before
: Filter todos due before this datedue_date_after
: Filter todos due after this datedue_soon
: Get todos due within the next 3 days (boolean)overdue
: Get overdue todos (boolean)skip
: Number of records to skip (pagination)limit
: Maximum number of records to return (pagination)
- Query parameters:
POST /api/todos
: Create a new todo (includes priority and due date)GET /api/todos/{todo_id}
: Get a specific todoPUT /api/todos/{todo_id}
: Update a todo (can update priority and due date)DELETE /api/todos/{todo_id}
: Delete a todo
Health
GET /health
: Check application health
API Documentation
- Swagger UI:
/docs
- ReDoc:
/redoc
Description
Languages
Python
95.7%
Mako
4.3%