
Create a full-featured task management API with the following components: - RESTful CRUD operations for tasks - Task status and priority management - SQLite database with SQLAlchemy ORM - Alembic migrations - Health check endpoint - Comprehensive API documentation
113 lines
3.0 KiB
Markdown
113 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 status and title
|
|
- Task prioritization
|
|
- Due date management
|
|
- Health check endpoint for monitoring
|
|
- Comprehensive API documentation
|
|
|
|
## Tech Stack
|
|
|
|
- **FastAPI**: Modern, fast web framework for building APIs
|
|
- **SQLAlchemy**: SQL toolkit and Object-Relational Mapping
|
|
- **Alembic**: Database migration tool
|
|
- **SQLite**: Lightweight, file-based database
|
|
- **Pydantic**: Data validation and settings management
|
|
- **Uvicorn**: ASGI server
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
taskmanagerapi/
|
|
├── alembic.ini # Alembic configuration
|
|
├── main.py # Application entry point
|
|
├── README.md # Project documentation
|
|
├── requirements.txt # Project dependencies
|
|
├── app/ # Application package
|
|
│ ├── api/ # API endpoints
|
|
│ │ └── api_v1/ # API version 1
|
|
│ │ ├── api.py # API router
|
|
│ │ └── endpoints/# API endpoint modules
|
|
│ ├── core/ # Core application code
|
|
│ │ └── config.py # Configuration settings
|
|
│ ├── crud/ # CRUD operations
|
|
│ ├── db/ # Database setup
|
|
│ ├── models/ # SQLAlchemy models
|
|
│ └── schemas/ # Pydantic schemas
|
|
└── migrations/ # Database migrations
|
|
├── env.py # Alembic environment
|
|
├── script.py.mako # Migration script template
|
|
└── versions/ # Migration versions
|
|
```
|
|
|
|
## Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
- Python 3.8+
|
|
|
|
### Installation
|
|
|
|
1. Clone the repository:
|
|
```bash
|
|
git clone https://github.com/yourusername/taskmanagerapi.git
|
|
cd taskmanagerapi
|
|
```
|
|
|
|
2. Install dependencies:
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
3. Run the application:
|
|
```bash
|
|
uvicorn main:app --reload
|
|
```
|
|
|
|
4. Access the API at `http://localhost:8000`
|
|
|
|
5. Access the API documentation at `http://localhost:8000/docs` or `http://localhost:8000/redoc`
|
|
|
|
## API Endpoints
|
|
|
|
### Health Check
|
|
|
|
- `GET /api/v1/health`: Check the health of the application
|
|
|
|
### Tasks
|
|
|
|
- `GET /api/v1/tasks`: List all tasks
|
|
- `POST /api/v1/tasks`: Create a new task
|
|
- `GET /api/v1/tasks/{id}`: Get a specific task
|
|
- `PUT /api/v1/tasks/{id}`: Update a specific task
|
|
- `DELETE /api/v1/tasks/{id}`: Delete a specific task
|
|
|
|
## Task Model
|
|
|
|
```json
|
|
{
|
|
"id": 1,
|
|
"title": "Complete project",
|
|
"description": "Finish the project by the deadline",
|
|
"status": "todo",
|
|
"priority": "high",
|
|
"due_date": "2023-12-31T23:59:59",
|
|
"created_at": "2023-09-01T12:00:00",
|
|
"updated_at": "2023-09-01T12:00:00"
|
|
}
|
|
```
|
|
|
|
## Filtering Tasks
|
|
|
|
- By status: `GET /api/v1/tasks?status=todo`
|
|
- By title: `GET /api/v1/tasks?title=project`
|
|
- Pagination: `GET /api/v1/tasks?skip=0&limit=10`
|
|
|
|
## License
|
|
|
|
This project is licensed under the MIT License. |