Go server to set tasks and subtasks with auto priority update and call reminders
- Endpoint:
POST /api/v1/task
- Input:
- Headers:
Authorization: Bearer <jwt-auth-token>
- Body:
{ "title": "Task Title", "description": "Task Description", "due_date": "2024-02-04T12:00:00Z" }
- Headers:
- Endpoint:
POST /api/v1/subtask
- Input:
- Headers:
Authorization: Bearer <jwt-auth-token>
- Body:
{ "task_id": "a1f8a062-76cb-4e78-a6e1-7e165c57fe07" }
- Headers:
- Endpoint:
GET /api/v1/task?page=1&limit=10
- Input:
- Headers:
Authorization: Bearer <jwt-auth-token>
- Body:
{ "priority" : Number, (optional) "due_date" : time (optional) }
- Headers:
- Endpoint:
GET /api/v1/subtask?page=1&limit=10
- Input:
- Headers:
Authorization: Bearer <jwt-auth-token>
- Body:
{ "task_id" : uuid, (optional) }
- Headers:
- Endpoint:
PUT /api/v1/task
- Input:
- Headers:
Authorization: Bearer <jwt-auth-token>
- Body:
{ "id": "", "due_date": "2024-02-15", "status": "DONE" }
- Headers:
- Endpoint:
PUT /api/v1/subtask
- Input:
- Headers:
Authorization: Bearer <jwt-auth-token>
- Body:
{ "id": "", "status": 1 }
- Headers:
- Endpoint:
DELETE /api/v1/task
- Input:
- Headers:
Authorization: Bearer <jwt-auth-token>
- Body:
{ "id": "", }
- Headers:
- Endpoint:
DELETE /api/v1/subtask
- Input:
- Headers:
Authorization: Bearer <jwt-auth-token>
- Body:
{ "id": "", }
- Headers:
- This cron job runs periodically to update the priority of tasks based on their due dates.
- Priority Rules:
- Priority 0: Due date is today.
- Priority 1: Due date is between tomorrow and the day after tomorrow.
- Priority 2: Due date is between 3-4 days
- Priority 3: Otherwise
- This cron job runs periodically to initiate voice calls using Twilio for tasks that pass their due dates.
- Calling Priority:
- Calls are made based on the priority of the user.
- Users with priority 0 are called first, followed by priority 1, and then priority 2.
- A user is called only if the previous user does not attend the call.
- Priority is fetched from the user table.
- Make the .env file from the .env.example
- In the root directory:
go mod tidy
go run main.go
The server would start in port 5000.