From f0afa5c6e9e1bec59181f53346b5f6b68d53033b Mon Sep 17 00:00:00 2001 From: Ajeyakrishna <98796547+Ajeyakrishna-k@users.noreply.github.com> Date: Sat, 9 Dec 2023 17:24:16 +0530 Subject: [PATCH 1/5] feat: adds tasks/users/discord route --- tasks/README.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tasks/README.md b/tasks/README.md index 3a08a8c..4258ee6 100644 --- a/tasks/README.md +++ b/tasks/README.md @@ -66,6 +66,7 @@ | [GET /tasks/:id/details](#get-tasksiddetails) | Get details of a particular task| | [GET /tasks/:username](#get-tasksusername) | Returns all tasks of the user | | [PATCH /tasks/self/:id](#patch-tasksselfid) | Changes in own task | +| [GET /tasks/users/discord](#get-tasksusersdiscord) | Returns discord details of users with active tasks | ## **GET /tasks** @@ -301,3 +302,38 @@ Returns all tasks of the requested user. - **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' }` + +## **GET /tasks/users/discord** + +Returns details of a particular task +- **Params** + None +- **Query** + - Optional: `q=[string]` (`q` can have the following values) + - Optional: `status=[string]` (`status` is a case senstive string with one of the following values [missed-updates] ) + - Optional: `date-count=[integer]` (`date-count` is the number of days where the users have not provided an update ont their task default :[3] ) + - Optional: `date=[timestamp]` (`date` is the timestamp of the date that needs to be excluded from the date-count. No default. eg [1702122435405] ) + - Optional: `weekday=[string]` (`weekday` the weekday that needs to be excluded while calculating the missed updates eg: [sun,mon,tue,wed,thu,fri,sat]) + - Optional: `size=[integer]` (`size` is the number of tasks that are processed to find the users. Range of value is 1-1000.) + - Optional: `cursor=[string]` (`cursor` is id of the document to get next page of results from that document) + eg: `?size=10&cursor=1xh3Bsd32&q=status:missed-updates -date-count:3 -date:1702122435405 -weekday:sun -weekday:sat` +- **Body** + None +- **Headers** + Content-Type: application/json +- **Success Response:** + - **Code:** 200 + - **Content:** +``` +{ + usersToAddRole: Array : `List of users who missed update` + tasks: number : `Total tasks processed` + missedUpdatesTasks: number : `Tasks with missed updates` + } +``` + +- **Error Response:** + - **Code:** 400 + - **Content:** `{ 'statusCode': 400, 'error': 'Bad request' }` + - **Code:** 500 + - **Content:** `{ 'statusCode': 500, 'error': 'Internal Server Error', 'message': 'An internal server error occurred' }` From 0336d291d8a013b9403bae201d9ec71e2503b978 Mon Sep 17 00:00:00 2001 From: Ajeyakrishna <98796547+Ajeyakrishna-k@users.noreply.github.com> Date: Sat, 9 Dec 2023 17:27:11 +0530 Subject: [PATCH 2/5] chore: improve description --- tasks/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/README.md b/tasks/README.md index 4258ee6..a4076fb 100644 --- a/tasks/README.md +++ b/tasks/README.md @@ -305,7 +305,7 @@ Returns all tasks of the requested user. ## **GET /tasks/users/discord** -Returns details of a particular task +Returns the list of users discord id who have not provided an update on their task - **Params** None - **Query** From 205bdcd713c68cb80f4fecbf36728c2b7aadafdc Mon Sep 17 00:00:00 2001 From: Ajeyakrishna <98796547+Ajeyakrishna-k@users.noreply.github.com> Date: Fri, 15 Dec 2023 18:25:26 +0530 Subject: [PATCH 3/5] chore: updates response object --- tasks/README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tasks/README.md b/tasks/README.md index a4076fb..99ba1f1 100644 --- a/tasks/README.md +++ b/tasks/README.md @@ -326,10 +326,13 @@ Returns the list of users discord id who have not provided an update on their ta - **Content:** ``` { - usersToAddRole: Array : `List of users who missed update` - tasks: number : `Total tasks processed` - missedUpdatesTasks: number : `Tasks with missed updates` - } + message: 'Discord details of users with status missed updates fetched successfully', + data: { + usersToAddRole: Array : `List of users who missed update` + tasks: number : `Total tasks processed` + missedUpdatesTasks: number : `Tasks with missed updates` + } +} ``` - **Error Response:** From 931afa28ad7595e539a850fbe207566e4e0df3dd Mon Sep 17 00:00:00 2001 From: Ajeyakrishna <98796547+Ajeyakrishna-k@users.noreply.github.com> Date: Thu, 11 Jan 2024 01:13:00 +0530 Subject: [PATCH 4/5] Update README.md --- tasks/README.md | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/tasks/README.md b/tasks/README.md index 99ba1f1..11205c8 100644 --- a/tasks/README.md +++ b/tasks/README.md @@ -304,19 +304,20 @@ Returns all tasks of the requested user. - **Content:** `{ 'statusCode': 500, 'error': 'Internal Server Error', 'message': 'An internal server error occurred' }` ## **GET /tasks/users/discord** +Returns a list of Discord IDs of users who have not provided progress updates on their tasks. + +- **Parameters**: None required. +- **Query Options**: + - `q=[string]`: Optional parameter. This query can include the following values: + - `status=[string]`: Optional. This is a case-sensitive string, accepting values like [missed-updates]. + - `date-count=[integer]`: Optional. Specifies the number of days during which users have not provided an update on their task. Default is [3]. + - `date=[timestamp]`: Optional. This is a timestamp which will be excluded while calculating missed updates. There is no default value (e.g., [1702122435405]). + - `weekday=[string]`: Optional. Specifies the weekday(s) to be excluded while calculating missed updates (e.g., [sun, mon, tue, wed, thu, fri, sat]). + - `size=[integer]`: Optional. Determines the number of tasks processed to identify the users. The value range is from 1 to 1000. + - `cursor=[string]`: Optional. This is the ID of the document used to retrieve the next page of results. + +Example usage: `?size=10&cursor=1xh3Bsd32&q=status:missed-updates -date-count:3 -date:1702122435405 -weekday:sun -weekday:sat` -Returns the list of users discord id who have not provided an update on their task -- **Params** - None -- **Query** - - Optional: `q=[string]` (`q` can have the following values) - - Optional: `status=[string]` (`status` is a case senstive string with one of the following values [missed-updates] ) - - Optional: `date-count=[integer]` (`date-count` is the number of days where the users have not provided an update ont their task default :[3] ) - - Optional: `date=[timestamp]` (`date` is the timestamp of the date that needs to be excluded from the date-count. No default. eg [1702122435405] ) - - Optional: `weekday=[string]` (`weekday` the weekday that needs to be excluded while calculating the missed updates eg: [sun,mon,tue,wed,thu,fri,sat]) - - Optional: `size=[integer]` (`size` is the number of tasks that are processed to find the users. Range of value is 1-1000.) - - Optional: `cursor=[string]` (`cursor` is id of the document to get next page of results from that document) - eg: `?size=10&cursor=1xh3Bsd32&q=status:missed-updates -date-count:3 -date:1702122435405 -weekday:sun -weekday:sat` - **Body** None - **Headers** From 895d3bd20a8526bca8d4f79c2a1c707f14679782 Mon Sep 17 00:00:00 2001 From: Ajeyakrishna <98796547+Ajeyakrishna-k@users.noreply.github.com> Date: Thu, 11 Jan 2024 01:15:13 +0530 Subject: [PATCH 5/5] Update README.md --- tasks/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/README.md b/tasks/README.md index 11205c8..13d5a90 100644 --- a/tasks/README.md +++ b/tasks/README.md @@ -327,7 +327,7 @@ Example usage: `?size=10&cursor=1xh3Bsd32&q=status:missed-updates -date-count:3 - **Content:** ``` { - message: 'Discord details of users with status missed updates fetched successfully', + message: 'Discord details of users fetched successfully', data: { usersToAddRole: Array : `List of users who missed update` tasks: number : `Total tasks processed`