diff --git a/users/README.md b/users/README.md index 9792c15d..c5c38343 100644 --- a/users/README.md +++ b/users/README.md @@ -34,15 +34,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 | -| [POST /users](#post-users) | Creates a new User | -| [PATCH /users/self](#patch-usersself) | Updates data of the User | +| 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 | +| [POST /users](#post-users) | Creates a new User | +| [PATCH /users/self](#patch-usersself) | Updates data of the User | +| [POST /users/](#) | Sync RDS users inDiscord role with Discord members | +| [GET /users//search/](#) | Search RDS users | + ## **GET /users** @@ -50,15 +53,15 @@ Returns all users in the system. - **Params** None -- **Query** +- **Query** - Optional: `size=[integer]` (`size` is number of users requested per page, - value ranges in between 1-100, and default value is 100) + value ranges in between 1-100, and default value is 100) - Optional: `page=[integer]` - (`page` can either be 0 or positive-number, and default value is 0) + (`page` can either be 0 or positive-number, and default value is 0) - Optional: `search=[string]` (`search` is a string value for username prefix) - Optional: `next=[string]` (`next` is id of the DB document to get next batch/page of results after that document.) - Optional: `prev=[string]` (`prev` is id of the DB document to get 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: `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) ) - **Body** None - **Headers** @@ -265,3 +268,56 @@ Updates data of the User. - **Code:** 503 - **Content:** `{ 'statusCode': 503, 'error': 'Service Unavailable', 'message': 'Something went wrong please contact admin' }` + +## **POST /users** + +It makes an API call to DISCORD_BOT and fetches a list of discord members and updates the **inDiscord** role for that users in our databse. + +- **Params** + None +- **Query** + None +- **Headers** + Content-Type: application/json +- **Cookie** + rds-session: `` +- **Authorize Roles:** SUPERUSER +- **Body** +None +- **Success Response:** + - **Code:** 204 + - **Content:** `{ 'message': 'Users data updated successfully!'}` + - **Code:** 401 + - **Content:** + `{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }` + - **Code:** 503 + - **Content:** + `{ 'statusCode': 503, 'error': 'Service Unavailable', 'message': 'Something went wrong please contact admin' }` + +## **GET /users/search/** +GET RDS users with role: inDiscord=true + + - **Params** + None + - **Query** + Optional: `role=string` + Optional: `verified=true` + - **Body** + None + - **Headers** + Content-Type: application/json + - **Cookie** + rds-session: `` + - **Success Response:** + - **Code:** 200 + - **Content:** + + ``` + { + message: 'Users returned successfully!' + users: [ + {} + ] + } + ``` +