todoapp-u8k61g/README.md
Automated Action 091c42482c Add todo categories and due dates with filtering capabilities
- Added category field to Todo model for organizing todos
- Added due_date field with timezone support for deadline tracking
- Enhanced CRUD operations with filtering by category, completion status, and overdue items
- Added new API endpoints for category-based and overdue todo retrieval
- Updated API documentation with new filtering query parameters
- Created database migration for new fields with proper indexing
- Updated README with comprehensive feature documentation
2025-06-17 05:51:35 +00:00

134 lines
3.4 KiB
Markdown

# Todo App API
A simple Todo application API built with FastAPI and SQLite.
## Features
- ✅ Create, read, update, and delete todos
- ✅ Todo categories/tags for organization
- ✅ Due dates with overdue detection
- ✅ Advanced filtering (by category, completion status, overdue)
- ✅ SQLite database with SQLAlchemy ORM
- ✅ Database migrations with Alembic
- ✅ API documentation with Swagger UI
- ✅ Health check endpoint
- ✅ CORS enabled for all origins
- ✅ Input validation with Pydantic
## Quick Start
### Prerequisites
- Python 3.8+
### Installation
1. Install dependencies:
```bash
pip install -r requirements.txt
```
2. Run database migrations:
```bash
alembic upgrade head
```
3. Start the development server:
```bash
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
```
Or alternatively:
```bash
python main.py
```
## API Endpoints
The API is available at `http://localhost:8000`
### Documentation
- **Swagger UI**: http://localhost:8000/docs
- **ReDoc**: http://localhost:8000/redoc
- **OpenAPI JSON**: http://localhost:8000/openapi.json
### Core Endpoints
- **GET** `/` - Root endpoint with project information
- **GET** `/health` - Health check endpoint
### Todo Endpoints
- **GET** `/api/v1/todos/` - List all todos (with pagination and filtering)
- Query parameters: `skip`, `limit`, `category`, `completed`, `overdue_only`
- **POST** `/api/v1/todos/` - Create a new todo
- **GET** `/api/v1/todos/{todo_id}` - Get a specific todo
- **PUT** `/api/v1/todos/{todo_id}` - Update a specific todo
- **DELETE** `/api/v1/todos/{todo_id}` - Delete a specific todo
- **GET** `/api/v1/todos/categories/{category}` - Get all todos by category
- **GET** `/api/v1/todos/overdue` - Get all overdue todos
## Database
The application uses SQLite database stored at `/app/storage/db/db.sqlite`.
### Schema
**todos** table:
- `id` (Integer, Primary Key)
- `title` (String, Required)
- `description` (String, Optional)
- `completed` (Boolean, Default: False)
- `category` (String, Optional) - For organizing todos
- `due_date` (DateTime with timezone, Optional) - When the todo is due
- `created_at` (DateTime with timezone)
- `updated_at` (DateTime with timezone)
## Development
### Linting and Formatting
```bash
# Check and fix linting issues
ruff check . --fix
# Format code
ruff format .
```
### Database Migrations
```bash
# Create a new migration
alembic revision --autogenerate -m "Description of changes"
# Apply migrations
alembic upgrade head
# Downgrade
alembic downgrade -1
```
## Project Structure
```
├── app/
│ ├── api/
│ │ └── v1/
│ │ ├── api.py # API router
│ │ └── todos.py # Todo endpoints
│ ├── core/
│ │ └── config.py # Configuration settings
│ ├── crud/
│ │ └── todo.py # CRUD operations
│ ├── db/
│ │ ├── base.py # SQLAlchemy base
│ │ ├── base_model.py # Model imports
│ │ └── session.py # Database session
│ ├── models/
│ │ └── todo.py # SQLAlchemy models
│ └── schemas/
│ └── todo.py # Pydantic schemas
├── migrations/ # Alembic migrations
├── main.py # FastAPI application
└── requirements.txt # Python dependencies
```