Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
44 changes: 28 additions & 16 deletions tasks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<task_id>,
<task_id>
],
"level": 1 | 2 | 3 | 4 | 5 // optional - can be added only if category exists,
"level": 1 | 2 | 3 | 4 | 5 // optional - can be added only if category exists,
"category": <string> // optional (example: "FRONTEND" | "BACKEND"),
"participants": [
// for group tasks
Expand Down Expand Up @@ -57,23 +57,23 @@

## **Requests**

| Route | Description |
| :--------------------------------: | :---------------: |
| [GET /tasks](#get-tasks) | Returns all tasks |
| [GET /tasks/self](#get-tasksself) | Returns all tasks of a user |
| [POST /tasks](#post-tasks) | Creates new task |
| [PATCH /tasks/:id](#patch-tasksid) | Updates tasks |
| [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 |
| Route | Description |
| :-------------------------------------------: | :------------------------------: |
| [GET /tasks](#get-tasks) | Returns all tasks |
| [GET /tasks/self](#get-tasksself) | Returns all tasks of a user |
| [POST /tasks](#post-tasks) | Creates new task |
| [PATCH /tasks/:id](#patch-tasksid) | Updates tasks |
| [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**

Returns all the tasks

- **Params**
None
- **Query**
- **Query**
- Optional: `dev=[boolean]` (`dev` is passed to get all tasks in the developer mode with features that are flagged)
- Optional: `status=[string]` (`status` is a case insenstive string with one of the following values [AVAILABLE, ASSIGNED, COMPLETED, IN_PROGRESS, BLOCKED, SMOKE_TESTING, NEEDS_REVIEW, IN_REVIEW, APPROVED, MERGED, SANITY_CHECK, REGRESSION_CHECK, RELEASED, VERIFIED, DONE, UNASSIGNED] which represents the status of the task)
- Optional: `assignee=[string]` (`assignee` can be assignee username in case of single assignee or multiple comma separated values in case of multiple assignee)
Expand All @@ -82,6 +82,7 @@ Returns all the tasks
- Optional: `size=[integer]` (`size` is the number of tasks requested per page. Range of value is 1-100. Default value is 5)
- Optional: `next=[string]` (`next` is id of the document to get next page of results from that document)
- Optional: `prev=[string]` (`prev` is id of the document to get prev page of results from that document)
- Optional: `orphaned=[boolean]` ( if departed is set to true with dev feature flag as true, it will return all the pending tasks which have assigned to users who have departed the discord server. )
- **Body**
None
- **Headers**
Expand All @@ -102,10 +103,16 @@ Returns all the tasks
}
```

- **Code:** 204 (for `orphaned=true` when no abandoned tasks exist)

- **Content:** `No Content`

- **Error Response:**
- **Code:** 500
- **Content:** `{ 'statusCode': 500, 'error': 'Internal Server Error', 'message': 'An internal server error occurred' }`

- **Code:** 404 (for `orphaned=true` without `dev=true`)
- **Content:**
`{ 'message': 'Route not found' }`

## **GET /tasks/self**

Expand All @@ -124,6 +131,7 @@ Returns all the completed tasks of user if query `completed=true` is passed, els
- **Success Response:**
- **Code:** 200
- **Content:**

```
[
{<task_object>},
Expand Down Expand Up @@ -157,6 +165,7 @@ Returns details of a particular task
- **Success Response:**
- **Code:** 200
- **Content:**

```
{
"message":"task returned successfully",
Expand Down Expand Up @@ -187,6 +196,7 @@ Returns all tasks of the requested user.
- **Success Response:**
- **Code:** 200
- **Content:**

```
{
message: 'Tasks returned successfully!'
Expand All @@ -203,7 +213,6 @@ Returns all tasks of the requested user.
- **Code:** 500
- **Content:** `{ 'statusCode': 500, 'error': 'Internal Server Error', 'message': 'An internal server error occurred' }`


## **POST /tasks**

- **Params**
Expand Down Expand Up @@ -265,10 +274,11 @@ Returns all tasks of the requested user.
- **Headers**
Content-Type: application/json

- **Body**
- **Body**

```
{
status: <new-status>
{
status: <new-status>
percentCompleted: <number>
}
```
Expand All @@ -278,6 +288,7 @@ Returns all tasks of the requested user.

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

```
{
message: 'Task updated successfully!'
Expand All @@ -292,6 +303,7 @@ Returns all tasks of the requested user.
}
}
```

- **Error Response:**
- **Code:** 401
- **Content:** `{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'User can not be authenticated' }`
Expand Down
104 changes: 63 additions & 41 deletions users/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ number and email address.

## **Requests**

| Route | Description |
| :----------------------------------------------------: | :----------------------------------: |
| [GET /users](#get-users) | Returns all users in the system |
| [GET /users/self](#get-usersSelf) | Returns the logged in user's details |
| [GET /users/userId/:userId](#get-usersuseriduserid) | Returns user with given userId |
| [GET /users/:username](#get-usersusername) | Returns user with given username |
| [GET /users/:userId/badges](#get-usersidbadges) | Returns badges assigned to the user |
| [GET /users/search](#get-users-search) | Returns users based on specified filters |
| [POST /users](#post-users) | Creates a new User |
| [PATCH /users/self](#patch-usersself) | Updates data of the User |
| [PATCH /users/:id/temporary/data](#patch-usersidroles) | Updates user roles |
| [PATCH /users](#patch-users) | Archive users if not in discord |
| Route | Description |
| :----------------------------------------------------: | :--------------------------------------: |
| [GET /users](#get-users) | Returns all users in the system |
| [GET /users/self](#get-usersSelf) | Returns the logged in user's details |
| [GET /users/userId/:userId](#get-usersuseriduserid) | Returns user with given userId |
| [GET /users/:username](#get-usersusername) | Returns user with given username |
| [GET /users/:userId/badges](#get-usersidbadges) | Returns badges assigned to the user |
| [GET /users/search](#get-users-search) | Returns users based on specified filters |
| [POST /users](#post-users) | Creates a new User |
| [PATCH /users/self](#patch-usersself) | Updates data of the User |
| [PATCH /users/:id/temporary/data](#patch-usersidroles) | Updates user roles |
| [PATCH /users](#patch-users) | Archive users if not in discord |

## **GET /users**

Expand All @@ -64,14 +64,17 @@ Returns all users in the system.
- Optional: `next=[string]` (`next` is the id of the DB document to get the next batch/page of results after that document.)
- Optional: `prev=[string]` (`prev` is the id of the DB document to get the previous batch/page of results before that document.)
- Optional: `query=[string]` (`query` can be used to filter and/or sort users based on their PR and Issue status within a given date range. [Learn more](https://github.com/Real-Dev-Squad/website-backend/wiki/Filter-and-sort-users-based-on-PRs-and-Issues) )
- Optional: `departed=[boolean]` ( if departed is set to true with dev feature flag as true, it will return all the users who have departed the discord server with pending tasks assigned to them. )
- **Body**
None
- **Headers**
Content-Type: application/json
- **Cookie**
rds-session: `<JWT>`
- **Success Response:**

- **Code:** 200

- **Content:**

```
Expand All @@ -88,7 +91,9 @@ Returns all users in the system.
```

**If `/users?profile=true`**

- **Code:** 200

- **Content:**

```
Expand All @@ -97,10 +102,20 @@ Returns all users in the system.
}
```

**If `/users?departed=true&dev=true`**

- **Code:** 204 (for `departed=true` when no abandoned tasks exist)

- **Content:**
`{}`

- **Error Response:**
- **Code:** 401
- **Content:**
`{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }`
- **Code:** 404 (for `departed=true` without `dev=true`)
- **Content:**
`{ 'message': 'Route not found' }

## **GET /users/self**

Expand Down Expand Up @@ -235,6 +250,7 @@ Returns users based on the specified filters.
None

- **Query Parameters:**

- Optional: `levelId=[string]` (Specifies the level ID)
- Optional: `levelName=[string]` (Specifies the level name)
- Optional: `levelValue=[number]` (Specifies the level value)
Expand All @@ -252,7 +268,9 @@ Returns users based on the specified filters.
rds-session: `<JWT>`

- **Success Response:**

- **Code:** 200

- **Content:**

```
Expand All @@ -270,11 +288,14 @@ Returns users based on the specified filters.
```

- **Error Response:**

- **Code:** 400

- **Content:**
`{ 'statusCode': 400, 'error': 'Bad Request', 'message': 'Filter for item not provided' }`

- **Code:** 401

- **Content:**
`{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }`

Expand Down Expand Up @@ -307,12 +328,13 @@ Creates a new User.
`{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }`

## **PATCH /users/self(To Be Deprecated)**
> **⚠️ Deprecation Notice**
>
> This endpoint is scheduled for deprecation. A new endpoint will be announced in the future to replace this functionality.
Please prepare to update your integrations accordingly.

Updates data of the User. Doesn't update if user is `(in_discord && !userDetailsIncomplete)`, Except for `disabled_roles` property.
> **⚠️ Deprecation Notice**
>
> This endpoint is scheduled for deprecation. A new endpoint will be announced in the future to replace this functionality.
> Please prepare to update your integrations accordingly.

Updates data of the User. Doesn't update if user is `(in_discord && !userDetailsIncomplete)`, Except for `disabled_roles` property.

- **Params**
None
Expand Down Expand Up @@ -396,7 +418,7 @@ Archive users if not in Discord.

```json
{
"action": "nonVerifiedDiscordUsers | archiveUsers"
"action": "nonVerifiedDiscordUsers | archiveUsers"
}
```

Expand All @@ -406,27 +428,27 @@ Archive users if not in Discord.

```json
{
"message": "Successfully updated users archived role to true if in_discord role is false | Couldn't find any users currently inactive in Discord but not archived.",
"data": {
"totalUsers": "number",
"totalUsersArchived": "number",
"totalOperationsFailed": "number"
}
"message": "Successfully updated users archived role to true if in_discord role is false | Couldn't find any users currently inactive in Discord but not archived.",
"data": {
"totalUsers": "number",
"totalUsersArchived": "number",
"totalOperationsFailed": "number"
}
}
```

**Addition info if debug query is set to true**

```json
{
"message": "Successfully updated users archived role to true if in_discord role is false | Couldn't find any users currently inactive in Discord but not archived.",
"data": {
"totalUsers": "number",
"totalUsersArchived": "number",
"totalOperationsFailed": "number",
"updatedUserDetails": "array",
"failedUserDetails": "array"
}
"message": "Successfully updated users archived role to true if in_discord role is false | Couldn't find any users currently inactive in Discord but not archived.",
"data": {
"totalUsers": "number",
"totalUsersArchived": "number",
"totalOperationsFailed": "number",
"updatedUserDetails": "array",
"failedUserDetails": "array"
}
}
```

Expand All @@ -438,9 +460,9 @@ Archive users if not in Discord.

```json
{
"statusCode": 401,
"error": "Unauthorized",
"message": "Unauthenticated User"
"statusCode": 401,
"error": "Unauthorized",
"message": "Unauthenticated User"
}
```

Expand All @@ -450,9 +472,9 @@ Archive users if not in Discord.

```json
{
"statusCode": 400,
"error": "Bad Request",
"message": "Invalid payload"
"statusCode": 400,
"error": "Bad Request",
"message": "Invalid payload"
}
```

Expand All @@ -462,8 +484,8 @@ Archive users if not in Discord.

```json
{
"statusCode": 500,
"error": "Internal Server Error",
"message": "An internal server error occurred"
"statusCode": 500,
"error": "Internal Server Error",
"message": "An internal server error occurred"
}
```