Automated Action fe3924497e Add todo due date and priority features
- 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)
2025-05-14 01:27:39 +00:00

82 lines
2.2 KiB
Markdown

# 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
1. Install dependencies:
```bash
pip install -r requirements.txt
```
2. Run migrations:
```bash
alembic upgrade head
```
3. Start the application:
```bash
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 date
- `due_date_after`: Filter todos due after this date
- `due_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)
- `POST /api/todos`: Create a new todo (includes priority and due date)
- `GET /api/todos/{todo_id}`: Get a specific todo
- `PUT /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`