Automated Action 53bc4e0199 Implement Task Manager API
- Set up FastAPI application structure
- Create Task model with SQLAlchemy
- Implement CRUD operations for tasks
- Add API endpoints for tasks with filtering options
- Configure Alembic for database migrations
- Add health check endpoint
- Configure Ruff for linting
- Add comprehensive documentation in README.md
2025-06-10 14:48:01 +00:00

117 lines
3.0 KiB
Markdown

# Task Manager API
A RESTful API for managing tasks, built with FastAPI and SQLite.
## Features
- Create, read, update, and delete tasks
- Filter tasks by title, priority, and completion status
- Pagination support
- Health check endpoint
- SQLite database with SQLAlchemy ORM
- Alembic for database migrations
- Comprehensive API documentation with Swagger UI
## Getting Started
### Prerequisites
- Python 3.8+
- pip
### Installation
1. Clone the repository
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Run database migrations:
```bash
alembic upgrade head
```
4. Start the application:
```bash
uvicorn main:app --reload
```
## API Endpoints
The API will be available at `http://localhost:8000`
- API Documentation: `http://localhost:8000/docs` or `http://localhost:8000/redoc`
- OpenAPI Schema: `http://localhost:8000/openapi.json`
- Health Check: `http://localhost:8000/health`
### Tasks Endpoints
- `GET /api/v1/tasks`: List all tasks (with optional filtering)
- `POST /api/v1/tasks`: Create a new task
- `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 Filtering Tasks
- `skip`: Number of tasks to skip (pagination)
- `limit`: Maximum number of tasks to return (pagination)
- `title`: Filter by title (partial match)
- `priority`: Filter by priority (1=Low, 2=Medium, 3=High)
- `completed`: Filter by completion status (true/false)
## Task Data Model
- `id`: Unique identifier
- `title`: Task title (required)
- `description`: Task description (optional)
- `completed`: Completion status (default: false)
- `priority`: Priority level (1=Low, 2=Medium, 3=High, default: 1)
- `due_date`: Due date (optional)
- `created_at`: Creation timestamp
- `updated_at`: Last update timestamp
## Development
### Project Structure
```
.
├── alembic.ini # Alembic configuration file
├── main.py # FastAPI application entry point
├── README.md # Project documentation
├── requirements.txt # Project dependencies
├── app/ # Application package
│ ├── api/ # API endpoints
│ │ └── v1/ # API version 1
│ │ └── endpoints/ # API endpoints modules
│ ├── core/ # Core application modules
│ ├── crud/ # CRUD operations
│ ├── db/ # Database setup and session
│ ├── models/ # SQLAlchemy models
│ └── schemas/ # Pydantic schemas
└── migrations/ # Alembic migrations
└── versions/ # Migration versions
```
### Database Migrations
To create a new migration after model changes:
```bash
alembic revision --autogenerate -m "description"
```
To apply migrations:
```bash
alembic upgrade head
```
## License
This project is licensed under the MIT License.