Automated Action 0d6888d900 Add Task Manager API with FastAPI and SQLite
- Created comprehensive task management system with CRUD operations
- Implemented SQLAlchemy models and database configuration
- Added Alembic migrations for database schema management
- Created FastAPI endpoints for task management with proper validation
- Added health check endpoint and base URL information
- Configured CORS middleware and OpenAPI documentation
- Updated README with comprehensive API documentation
- Code formatted and linted with Ruff
2025-07-07 20:49:13 +00:00

97 lines
2.5 KiB
Markdown

# Task Manager API
A simple and efficient task management API built with FastAPI and SQLite.
## Features
- Create, read, update, and delete tasks
- Filter tasks by completion status
- Filter tasks by priority level
- Automatic timestamps for task creation and updates
- SQLite database with SQLAlchemy ORM
- Database migrations with Alembic
- Interactive API documentation with Swagger UI
- Health check endpoint
- CORS support for cross-origin requests
## Installation
1. Clone the repository
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Run the application:
```bash
uvicorn main:app --reload
```
## API Endpoints
### Base Information
- `GET /` - API information and available endpoints
- `GET /health` - Health check endpoint
### Task Management
- `POST /api/v1/tasks` - Create a new task
- `GET /api/v1/tasks` - List all tasks (with optional filtering)
- `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
- `GET /api/v1/tasks/priority/{priority}` - Get tasks by priority
### Query Parameters
- `skip` - Number of tasks to skip (pagination)
- `limit` - Maximum number of tasks to return
- `completed` - Filter by completion status (true/false)
## Task Schema
```json
{
"id": 1,
"title": "Example Task",
"description": "Task description",
"completed": false,
"priority": "medium",
"created_at": "2024-01-01T00:00:00",
"updated_at": "2024-01-01T00:00:00",
"due_date": "2024-01-02T00:00:00"
}
```
## Priority Levels
- `low`
- `medium`
- `high`
## Database
The application uses SQLite as the database, stored in `/app/storage/db/db.sqlite`. The database schema is managed using Alembic migrations.
## API Documentation
Once the application is running, you can access:
- Swagger UI: `http://localhost:8000/docs`
- ReDoc: `http://localhost:8000/redoc`
- OpenAPI JSON: `http://localhost:8000/openapi.json`
## Development
### Running with uvicorn
```bash
uvicorn main:app --reload --host 0.0.0.0 --port 8000
```
### Database Migrations
The application automatically creates the database tables on startup. Migration files are located in the `alembic/versions/` directory.
## Health Check
The API provides a health check endpoint at `/health` that returns the current status of the service.
## CORS Configuration
The API is configured to allow all origins for development purposes. In production, you should restrict this to specific domains.