
- Added priority field (low, medium, high) to Todo model - Created migration for priority field addition - Updated API schemas to include priority - Added filtering by priority in GET todos endpoint - Updated README to reflect new features
71 lines
2.1 KiB
Markdown
71 lines
2.1 KiB
Markdown
# Simple Todo Application
|
|
|
|
A simple Todo API built with FastAPI and SQLite.
|
|
|
|
## Features
|
|
|
|
- Create, Read, Update, and Delete Todo items
|
|
- Priority levels (Low, Medium, High) for todo items
|
|
- Filter todo items by priority
|
|
- SQLite database with SQLAlchemy ORM
|
|
- Database migrations with Alembic
|
|
- API documentation with Swagger UI and ReDoc
|
|
- Health check endpoint
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
/
|
|
├── app/ # Main application package
|
|
│ ├── api/ # API endpoints
|
|
│ │ ├── health.py # Health check endpoint
|
|
│ │ ├── schemas.py # Pydantic models
|
|
│ │ └── todos.py # Todo CRUD endpoints
|
|
│ ├── database/ # Database configuration
|
|
│ │ └── config.py # SQLAlchemy setup
|
|
│ └── models/ # SQLAlchemy models
|
|
│ └── todo.py # Todo model
|
|
├── migrations/ # Alembic migrations
|
|
│ └── versions/ # Migration scripts
|
|
├── alembic.ini # Alembic configuration
|
|
├── main.py # Application entry point
|
|
└── requirements.txt # Python dependencies
|
|
```
|
|
|
|
## API Endpoints
|
|
|
|
- `GET /api/todos`: Get all todo items (optional query parameter `priority` to filter by priority)
|
|
- `POST /api/todos`: Create a new todo item with optional priority level
|
|
- `GET /api/todos/{todo_id}`: Get a specific todo item
|
|
- `PUT /api/todos/{todo_id}`: Update a todo item (including its priority)
|
|
- `DELETE /api/todos/{todo_id}`: Delete a todo item
|
|
- `GET /health`: Check application health
|
|
|
|
## Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
- Python 3.8 or higher
|
|
|
|
### Installation
|
|
|
|
1. Clone the repository
|
|
2. Install dependencies:
|
|
```
|
|
pip install -r requirements.txt
|
|
```
|
|
3. Run the application:
|
|
```
|
|
uvicorn main:app --reload
|
|
```
|
|
|
|
### API Documentation
|
|
|
|
Once the application is running, you can access the API documentation at:
|
|
|
|
- Swagger UI: http://localhost:8000/docs
|
|
- ReDoc: http://localhost:8000/redoc
|
|
|
|
## Database
|
|
|
|
The application uses SQLite as the database with SQLAlchemy ORM. The database file is stored at `/app/storage/db/db.sqlite`. |