A FastAPI-based notification service that monitors tasks in a To-Do application and generates notifications for tasks that are due soon or overdue.
- Monitors task due dates and statuses
- Automatically identifies tasks that are:
- Due within 7 days (marked as DUE_SOON)
- Past their due date (marked as OVERDUE)
- Generates notifications for tasks requiring attention
- RESTful API endpoint for retrieving notifications
.
├── app/
│ ├── models/
│ │ ├── notification.py
│ │ └── task.py
│ ├── services/
│ │ ├── notification_service.py
│ │ └── task_fetcher.py
│ └── main.py
├── tests/
│ └── notification_test.py
├── Dockerfile
└── requirements.txt
- Python 3.x
- pip (Python package manager)
- Clone the repository
- Create a virtual environment:
python -m venv .venv .venv\Scripts\activate # Windows
- Install dependencies:
pip install -r requirements.txt
- Start the FastAPI server:
uvicorn app.main:app --reload
- The service will be available at
http://127.0.0.1:8000
Returns a list of notifications for tasks that are either due soon or overdue.
Response format:
[
{
"task_id": 1,
"title": "Task Title",
"message": "Task is due soon",
"status": "DUE_SOON"
}
]Run the test suite using pytest:
pytest tests/The service can be containerized using the provided Dockerfile.
Last Updated: 21-03-2025 ⸺ Last Reviewed: 21-03-2025