Skip to content

Commit

Permalink
DOC: Added an API contract for PATCH /tasks status updates (#214)
Browse files Browse the repository at this point in the history
* updated doc to include new task status update

* added one new patch route for tasks status updates

* ok removed

* updated doc patch route for tasks status updates
  • Loading branch information
vikasosmium authored Dec 27, 2024
1 parent 1432324 commit 490ad71
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions tasks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
| [GET /tasks/:username](#get-tasksusername) | Returns all tasks of the user |
| [PATCH /tasks/self/:id](#patch-tasksselfid) | Changes in own task |
| [PATCH /tasks/assign/:userId]() | Assigns the task based on task availability and skill |
| [PATCH /tasks/:id/status]() | Changes the status in own task |

## **GET /tasks**

Expand Down Expand Up @@ -342,3 +343,52 @@ Returns all tasks of the requested user.
- **Error Response:**
- **Code:** 500
- **Content:** `{ 'statusCode': 500, 'error': 'Internal Server Error', 'message': 'An internal server error occurred' }`


## **PATCH /tasks/:id/status**

- **Params**
_Required:_ `id=[string]`

- **Headers**
Content-Type: application/json

- **Body**

```
{
status: <new-status>
percentCompleted: <number>
}
```

- **Cookie**
rds-session: `<JWT>`

- **Success Response:**
- **Code**: 200

```
{
message: 'Task updated successfully!'
userStatus?: {
status : "String",
message : "String"
data: {
"previousStatus"?: "String",
"currentStatus"?: "String",
"futureStatus"?: "String"
}
}
}
```

- **Error Response:**
- **Code:** 401
- **Content:** `{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }`
- **Code:** 403
- **Content:** `{ 'statusCode': 403, 'error': 'Forbidden', 'message':'This task is not assigned to you' }`
- **Code:** 404
- **Content:** `{ 'statusCode': 404, 'error': 'Not Found', 'message': 'Task doesn't exist' }`
- **Code:** 500
- **Content:** `{ 'statusCode': 500, 'error': 'Internal Server Error', 'message': 'An internal server error occurred' }`

0 comments on commit 490ad71

Please sign in to comment.