# Task Management Tool A robust task management API built with FastAPI and SQLite. ## Features - User authentication with JWT - Task management (create, read, update, delete) - Task priority and status tracking - Role-based access control (admin/regular users) - Error handling and validation - SQLite database with SQLAlchemy ORM - Database migrations with Alembic ## Requirements - Python 3.8+ - FastAPI - SQLAlchemy - Alembic - Pydantic - Python-jose - Passlib - Email-validator - Uvicorn ## Installation 1. Clone the repository ```bash git clone cd taskmanagementtool ``` 2. Install dependencies ```bash pip install -r requirements.txt ``` 3. Set up environment variables (or use default values for development) ```bash # JWT Secret Key export SECRET_KEY="your-secret-key-here" # JWT Algorithm export ALGORITHM="HS256" # JWT Token Expiration (minutes) export ACCESS_TOKEN_EXPIRE_MINUTES="11520" # 8 days ``` 4. Run database migrations ```bash alembic upgrade head ``` 5. Start the server ```bash uvicorn main:app --reload ``` The API will be available at http://localhost:8000 ## API Documentation API documentation is automatically generated and available at: - Swagger UI: http://localhost:8000/docs - ReDoc: http://localhost:8000/redoc ## API Endpoints ### Authentication - `POST /api/v1/auth/login` - Get access token - `POST /api/v1/auth/test-token` - Test if token is valid ### Users - `GET /api/v1/users/` - List all users (admin only) - `POST /api/v1/users/` - Create a new user - `GET /api/v1/users/me` - Get current user information - `PUT /api/v1/users/me` - Update current user information - `GET /api/v1/users/{user_id}` - Get user by ID ### Tasks - `GET /api/v1/tasks/` - List tasks (admins see all, users see their own) - `POST /api/v1/tasks/` - Create a new task - `GET /api/v1/tasks/{id}` - Get task by ID - `PUT /api/v1/tasks/{id}` - Update task - `DELETE /api/v1/tasks/{id}` - Delete task ### Health - `GET /api/v1/health` - Check if the service is running ## Task Model Tasks have the following attributes: - `id`: Unique identifier - `title`: Task title - `description`: Detailed description - `priority`: Priority level (LOW, MEDIUM, HIGH) - `status`: Current status (TODO, IN_PROGRESS, DONE) - `due_date`: Optional due date - `user_id`: Owner of the task - `created_at`: Creation timestamp - `updated_at`: Last update timestamp ## Environment Variables | Variable | Description | Default | |----------|-------------|---------| | SECRET_KEY | JWT Secret Key | "YOUR_SECRET_KEY_HERE" | | ALGORITHM | JWT Algorithm | "HS256" | | ACCESS_TOKEN_EXPIRE_MINUTES | JWT Token Expiration (minutes) | 11520 (8 days) | ## License This project is licensed under the MIT License.