Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds tasks/users/discord route #173

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions tasks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand Down Expand Up @@ -301,3 +302,41 @@ 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 the list of users discord id who have not provided an update on their task
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check grammar here

- **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] )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

date-count from where

- 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:**
```
{
message: 'Discord details of users with status missed updates fetched successfully',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you re-phrase this line

data: {
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' }`