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

updated api contract for users #126

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
35 changes: 34 additions & 1 deletion users/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'designation': string,
'img': string,
'github_id': string,
'github_user_id': string,
sahsisunny marked this conversation as resolved.
Show resolved Hide resolved
'linkedin_id': string,
'twitter_id': string,
'instagram_id': string,
Expand Down Expand Up @@ -42,7 +43,8 @@ number and email address.
| [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 |
| [PATCH /users/self](#patch-usersself) | Updates data of the User |
| [POST /users/migrate](#post-users) | Adds github_user_id field
heyrandhir marked this conversation as resolved.
Show resolved Hide resolved

## **GET /users**

Expand Down Expand Up @@ -265,3 +267,34 @@ Updates data of the User.
- **Code:** 503
- **Content:**
`{ 'statusCode': 503, 'error': 'Service Unavailable', 'message': 'Something went wrong please contact admin' }`

## **PATCH /users/migrate**

Migrate existing users document with new github_user_id field.

- **Params**
None
- **Query**
None
- **Headers**
Content-Type: application/json
- **Cookie**
rds-session: `<JWT>`
- **Body** `{ <user_object> }`
- **Success Response:**
- **Code:** 204
- **Content:** `{ 'message': 'User updated successfully!'}`
- **Error Response:**
- **Code:** 404
- **Content:**
`{ 'statusCode': 404, 'error': 'Not Found', 'message': 'User not found' }`
- **Code:** 401
- **Content:**
`{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }`
- **Code:** 403
- **Content:**
`{ 'statusCode': 403, 'error': 'Forbidden', 'message': 'Cannot update username again'}`
- **Code:** 503
- **Content:**
`{ 'statusCode': 503, 'error': 'Service Unavailable', 'message': 'Something went wrong please contact admin' }`

heyrandhir marked this conversation as resolved.
Show resolved Hide resolved