Skip to content

Commit 490ad71

Browse files
authored
DOC: Added an API contract for PATCH /tasks status updates (#214)
* 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
1 parent 1432324 commit 490ad71

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

tasks/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
| [GET /tasks/:username](#get-tasksusername) | Returns all tasks of the user |
6868
| [PATCH /tasks/self/:id](#patch-tasksselfid) | Changes in own task |
6969
| [PATCH /tasks/assign/:userId]() | Assigns the task based on task availability and skill |
70+
| [PATCH /tasks/:id/status]() | Changes the status in own task |
7071

7172
## **GET /tasks**
7273

@@ -342,3 +343,52 @@ Returns all tasks of the requested user.
342343
- **Error Response:**
343344
- **Code:** 500
344345
- **Content:** `{ 'statusCode': 500, 'error': 'Internal Server Error', 'message': 'An internal server error occurred' }`
346+
347+
348+
## **PATCH /tasks/:id/status**
349+
350+
- **Params**
351+
_Required:_ `id=[string]`
352+
353+
- **Headers**
354+
Content-Type: application/json
355+
356+
- **Body**
357+
358+
```
359+
{
360+
status: <new-status>
361+
percentCompleted: <number>
362+
}
363+
```
364+
365+
- **Cookie**
366+
rds-session: `<JWT>`
367+
368+
- **Success Response:**
369+
- **Code**: 200
370+
371+
```
372+
{
373+
message: 'Task updated successfully!'
374+
userStatus?: {
375+
status : "String",
376+
message : "String"
377+
data: {
378+
"previousStatus"?: "String",
379+
"currentStatus"?: "String",
380+
"futureStatus"?: "String"
381+
}
382+
}
383+
}
384+
```
385+
386+
- **Error Response:**
387+
- **Code:** 401
388+
- **Content:** `{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }`
389+
- **Code:** 403
390+
- **Content:** `{ 'statusCode': 403, 'error': 'Forbidden', 'message':'This task is not assigned to you' }`
391+
- **Code:** 404
392+
- **Content:** `{ 'statusCode': 404, 'error': 'Not Found', 'message': 'Task doesn't exist' }`
393+
- **Code:** 500
394+
- **Content:** `{ 'statusCode': 500, 'error': 'Internal Server Error', 'message': 'An internal server error occurred' }`

0 commit comments

Comments
 (0)