88 lines
2.1 KiB
Markdown
88 lines
2.1 KiB
Markdown
# Task Manager API
|
|
|
|
A simple and efficient Task Manager API built with FastAPI and SQLite.
|
|
|
|
## Features
|
|
|
|
- Create, read, update, and delete tasks
|
|
- Filter tasks by completion status
|
|
- Set task priorities
|
|
- Set due dates for tasks
|
|
- Health check endpoint
|
|
|
|
## Technology Stack
|
|
|
|
- **Python**: 3.8+
|
|
- **Web Framework**: FastAPI
|
|
- **ORM**: SQLAlchemy 2.0+
|
|
- **Database**: SQLite
|
|
- **Migrations**: Alembic
|
|
- **Linting**: Ruff
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
taskmanagerapi/
|
|
│
|
|
├── alembic/ # Database migration scripts
|
|
│ └── versions/ # Migration versions
|
|
│
|
|
├── app/ # Application module
|
|
│ ├── api/ # API endpoints
|
|
│ │ └── routes/ # API route handlers
|
|
│ ├── core/ # Core application code
|
|
│ ├── crud/ # CRUD operations
|
|
│ ├── db/ # Database setup and connections
|
|
│ ├── models/ # SQLAlchemy models
|
|
│ └── schemas/ # Pydantic models for validation
|
|
│
|
|
├── main.py # Application entry point
|
|
└── requirements.txt # Project dependencies
|
|
```
|
|
|
|
## API Endpoints
|
|
|
|
### Tasks
|
|
|
|
- `GET /api/v1/tasks`: Get 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
|
|
|
|
### Health Check
|
|
|
|
- `GET /health`: Check API health
|
|
|
|
## Installation and Setup
|
|
|
|
1. Clone the repository
|
|
2. Install dependencies:
|
|
```
|
|
pip install -r requirements.txt
|
|
```
|
|
3. Run database migrations:
|
|
```
|
|
alembic upgrade head
|
|
```
|
|
4. Start the application:
|
|
```
|
|
uvicorn main:app --reload
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
If you encounter a "PydanticUserError: A non-annotated attribute was detected" error:
|
|
- This is resolved by moving DB_DIR outside the Settings class in app/core/config.py
|
|
- A validation script (start.py) is included to verify the app loads correctly
|
|
|
|
## API Documentation
|
|
|
|
FastAPI automatically generates interactive API documentation at:
|
|
|
|
- `/docs`: Swagger UI
|
|
- `/redoc`: ReDoc
|
|
|
|
## License
|
|
|
|
MIT |