# Task Manager API A FastAPI-based Task Manager API with SQLite database and JWT authentication. ## Features - User management (register, login, update profile) - Task management (create, read, update, delete) - Task assignment to other users - Task filtering by status - JWT authentication - Role-based access control (regular users and superusers) ## Tech Stack - **Framework**: FastAPI - **Database**: SQLite with SQLAlchemy ORM - **Migrations**: Alembic - **Authentication**: JWT tokens (via python-jose) - **Password Hashing**: Bcrypt - **Validation**: Pydantic ## Project Structure ``` ├── app/ │ ├── api/ │ │ └── v1/ │ │ ├── endpoints/ │ │ │ ├── auth.py │ │ │ ├── tasks.py │ │ │ └── users.py │ │ └── api.py │ ├── core/ │ │ ├── auth.py │ │ └── config.py │ ├── crud/ │ │ ├── task.py │ │ └── user.py │ ├── db/ │ │ ├── base_class.py │ │ ├── base.py │ │ └── session.py │ ├── models/ │ │ ├── task.py │ │ └── user.py │ ├── schemas/ │ │ ├── task.py │ │ ├── token.py │ │ └── user.py │ └── storage/ │ └── db/ ├── migrations/ │ └── versions/ ├── alembic.ini ├── main.py ├── README.md └── requirements.txt ``` ## Environment Variables This application uses the following environment variables: | Variable | Description | Default | |----------|-------------|---------| | SECRET_KEY | JWT secret key | supersecretkey | | ACCESS_TOKEN_EXPIRE_MINUTES | JWT token expiration time in minutes | 60 | ## Getting Started ### Prerequisites - Python 3.8 or higher ### Installation 1. Clone the repository 2. Install dependencies ```bash pip install -r requirements.txt ``` 3. Run the application ```bash uvicorn main:app --reload ``` 4. Access the API documentation - Swagger UI: [http://localhost:8000/docs](http://localhost:8000/docs) - ReDoc: [http://localhost:8000/redoc](http://localhost:8000/redoc) ### Database Migrations Apply migrations to create the database schema: ```bash alembic upgrade head ``` ## API Endpoints ### Authentication - `POST /api/v1/auth/register` - Register a new user - `POST /api/v1/auth/token` - Login and get access token ### Users - `GET /api/v1/users/me` - Get current user - `PUT /api/v1/users/me` - Update current user - `GET /api/v1/users/{user_id}` - Get user by ID - `GET /api/v1/users/` - List all users (superuser only) - `POST /api/v1/users/` - Create a new user (superuser only) - `PUT /api/v1/users/{user_id}` - Update a user (superuser only) ### Tasks - `GET /api/v1/tasks/` - List tasks (with optional status filter) - `POST /api/v1/tasks/` - Create a new task - `GET /api/v1/tasks/{task_id}` - Get a task by ID - `PUT /api/v1/tasks/{task_id}` - Update a task - `DELETE /api/v1/tasks/{task_id}` - Delete a task - `POST /api/v1/tasks/{task_id}/assign/{user_id}` - Assign a task to a user ### Health Check - `GET /health` - Check API health ## License This project is licensed under the MIT License.