From 490ad716d5ef8b2060e54311cf04b4cf2faee394 Mon Sep 17 00:00:00 2001 From: Vikas Singh <59792866+vikasosmium@users.noreply.github.com> Date: Fri, 27 Dec 2024 23:18:52 +0530 Subject: [PATCH] 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 --- tasks/README.md | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tasks/README.md b/tasks/README.md index fe70a31..4238bd9 100644 --- a/tasks/README.md +++ b/tasks/README.md @@ -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** @@ -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: + percentCompleted: + } + ``` + +- **Cookie** + rds-session: `` + +- **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' }` \ No newline at end of file