
- Implemented CRUD operations for task management - Added task status tracking (pending, in_progress, completed) - Included priority levels (low, medium, high) - Set up SQLite database with Alembic migrations - Added filtering and pagination support - Configured CORS for all origins - Included health check endpoint - Added comprehensive API documentation - Formatted code with Ruff linting
Task Management Tool
A simple and efficient task management API built with FastAPI and SQLite.
Features
- CRUD Operations: Create, read, update, and delete tasks
- Task Status Management: Track tasks as pending, in progress, or completed
- Priority Levels: Set task priorities (low, medium, high)
- Filtering: Filter tasks by status and priority
- Pagination: Support for skip/limit pagination
- Health Check: Built-in health monitoring endpoint
- Interactive Documentation: Automatic API documentation with Swagger UI
API Endpoints
Base
GET /
- Service information and documentation linksGET /health
- Health check endpoint
Tasks
POST /api/v1/tasks/
- Create a new taskGET /api/v1/tasks/
- List all tasks (with filtering and pagination)GET /api/v1/tasks/{task_id}
- Get a specific taskPUT /api/v1/tasks/{task_id}
- Update a taskDELETE /api/v1/tasks/{task_id}
- Delete a task
Query Parameters for GET /api/v1/tasks/
skip
: Number of tasks to skip (default: 0)limit
: Number of tasks to return (default: 100, max: 1000)status
: Filter by task status (pending, in_progress, completed)priority
: Filter by task priority (low, medium, high)
Installation
- Install dependencies:
pip install -r requirements.txt
- Run the application:
uvicorn main:app --host 0.0.0.0 --port 8000
The application will be available at:
- API: http://localhost:8000
- Documentation: http://localhost:8000/docs
- Alternative Documentation: http://localhost:8000/redoc
- OpenAPI Schema: http://localhost:8000/openapi.json
Database
This application uses SQLite as the database backend. The database file is stored at /app/storage/db/db.sqlite
.
Database migrations are handled with Alembic. The initial migration creates the tasks table with the following schema:
id
: Primary key (integer)title
: Task title (string, max 200 characters)description
: Optional task description (text)status
: Task status enum (pending, in_progress, completed)priority
: Task priority enum (low, medium, high)created_at
: Creation timestampupdated_at
: Last update timestamp
Development
The codebase follows these conventions:
- Code formatting with Ruff
- SQLAlchemy for database ORM
- Pydantic for data validation
- FastAPI for the web framework
- CORS enabled for all origins
Task Model
{
"id": 1,
"title": "Sample Task",
"description": "This is a sample task description",
"status": "pending",
"priority": "medium",
"created_at": "2024-01-01T12:00:00Z",
"updated_at": "2024-01-01T12:00:00Z"
}
Description
Languages
Python
94.7%
Mako
5.3%