Automated Action 97c3923628 Build complete task management tool with FastAPI and SQLite
- 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
2025-06-19 05:20:58 +00:00

88 lines
2.6 KiB
Markdown

# 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 links
- `GET /health` - Health check endpoint
### Tasks
- `POST /api/v1/tasks/` - Create a new task
- `GET /api/v1/tasks/` - List all tasks (with filtering and pagination)
- `GET /api/v1/tasks/{task_id}` - Get a specific task
- `PUT /api/v1/tasks/{task_id}` - Update a task
- `DELETE /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
1. Install dependencies:
```bash
pip install -r requirements.txt
```
2. Run the application:
```bash
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 timestamp
- `updated_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
```json
{
"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"
}
```