
Features: - User authentication with JWT tokens - Task and project CRUD operations - Task filtering and organization generated with BackendIM... (backend.im)
3.5 KiB
3.5 KiB
Task Management System
A RESTful API for managing tasks and projects, built with FastAPI and SQLite.
Features
- User authentication with JWT tokens
- CRUD operations for tasks and projects
- Task prioritization and status tracking
- Project organization for tasks
- Filter tasks by status, priority, and project
API Endpoints
GET /health
- Health check endpointPOST /token
- Login and get access tokenPOST /users/
- Register a new userGET /users/me
- Get current user infoGET /tasks/
- List all tasks (with filters)POST /tasks/
- Create a new taskGET /tasks/{task_id}
- Get a specific taskPUT /tasks/{task_id}
- Update a taskDELETE /tasks/{task_id}
- Delete a taskGET /projects/
- List all projectsPOST /projects/
- Create a new projectGET /projects/{project_id}
- Get a specific projectPUT /projects/{project_id}
- Update a projectDELETE /projects/{project_id}
- Delete a project
Getting Started
Prerequisites
- Python 3.8 or higher
Installation
-
Clone the repository:
git clone https://github.com/yourusername/task-management-system.git cd task-management-system
-
Install dependencies:
pip install -r requirements.txt
-
Run database migrations:
alembic upgrade head
-
Start the application:
uvicorn main:app --reload
-
Access the API documentation at
http://localhost:8000/docs
Usage
Authentication
-
Create a new user:
curl -X 'POST' \ 'http://localhost:8000/users/' \ -H 'Content-Type: application/json' \ -d '{ "username": "testuser", "email": "user@example.com", "password": "password123" }'
-
Get an access token:
curl -X 'POST' \ 'http://localhost:8000/token' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'username=testuser&password=password123'
-
Use the token for authenticated requests:
curl -X 'GET' \ 'http://localhost:8000/users/me' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN'
Task Management
-
Create a new task:
curl -X 'POST' \ 'http://localhost:8000/tasks/' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "title": "Task Title", "description": "Task Description", "priority": "HIGH", "status": "TODO" }'
-
Get all tasks:
curl -X 'GET' \ 'http://localhost:8000/tasks/' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN'
-
Filter tasks by status:
curl -X 'GET' \ 'http://localhost:8000/tasks/?status=TODO' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN'
Project Management
-
Create a new project:
curl -X 'POST' \ 'http://localhost:8000/projects/' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "name": "Project Name", "description": "Project Description" }'
-
Create a task in a project:
curl -X 'POST' \ 'http://localhost:8000/tasks/' \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "title": "Task Title", "description": "Task Description", "priority": "HIGH", "status": "TODO", "project_id": 1 }'
API Documentation
- Swagger UI:
http://localhost:8000/docs
- ReDoc:
http://localhost:8000/redoc