From 05d522d06575822923f8943058ffafe95bf22f51 Mon Sep 17 00:00:00 2001 From: sinhayash9546 Date: Wed, 3 May 2023 13:02:58 +0530 Subject: [PATCH 1/2] updated api contract for users --- users/README.md | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/users/README.md b/users/README.md index 9792c15..f7ec058 100644 --- a/users/README.md +++ b/users/README.md @@ -15,6 +15,7 @@ 'designation': string, 'img': string, 'github_id': string, + 'github_user_id': string, 'linkedin_id': string, 'twitter_id': string, 'instagram_id': string, @@ -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 ## **GET /users** @@ -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: `` +- **Body** `{ }` +- **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' }` + \ No newline at end of file From 0b49c7e747aa357ce875feb0be6f9138beccc7ea Mon Sep 17 00:00:00 2001 From: sinhayash9546 Date: Thu, 4 May 2023 19:30:22 +0530 Subject: [PATCH 2/2] added closing tag and error status code --- users/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/users/README.md b/users/README.md index f7ec058..5d669a8 100644 --- a/users/README.md +++ b/users/README.md @@ -44,7 +44,7 @@ number and email address. | [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/migrate](#post-users) | Adds github_user_id field +| [POST /users/migrate](#post-users) | Adds github_user_id field | ## **GET /users** @@ -268,7 +268,7 @@ Updates data of the User. - **Content:** `{ 'statusCode': 503, 'error': 'Service Unavailable', 'message': 'Something went wrong please contact admin' }` -## **PATCH /users/migrate** +## **POST /users/migrate** Migrate existing users document with new github_user_id field. @@ -294,7 +294,7 @@ Migrate existing users document with new github_user_id field. - **Code:** 403 - **Content:** `{ 'statusCode': 403, 'error': 'Forbidden', 'message': 'Cannot update username again'}` - - **Code:** 503 + - **Code:** 500 - **Content:** - `{ 'statusCode': 503, 'error': 'Service Unavailable', 'message': 'Something went wrong please contact admin' }` + `{ 'statusCode': 500, 'error': 'Server Error', 'message': 'Internal Server Error' }` \ No newline at end of file