From f287dfff0a9ece96b2b14b3354d48501c319de3f Mon Sep 17 00:00:00 2001 From: vivek lokhande Date: Sat, 5 Aug 2023 11:22:12 +0530 Subject: [PATCH 1/2] (#146) API contract for adding a colors property to exisitng users --- user-migrations/README.md | 76 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 user-migrations/README.md diff --git a/user-migrations/README.md b/user-migrations/README.md new file mode 100644 index 00000000..036fb966 --- /dev/null +++ b/user-migrations/README.md @@ -0,0 +1,76 @@ +# Collection - Users + +## API Endpoints + +| Route | Description | +| :---------------------------------------------------------------------------------------: | :--------------------------------------------------------------: | +| [PATCH /migrations/addDefaultColorProperty](#patch-migrations-add_default_color_property) | Adds a colors property all to users, without the colors property | + +## PATCH /migrations/addDefaultColorProperty + +Adds a colors field to every exisiting user. + +- **Params** + None +- **Query** + None +- **Headers** + Content-Type: application/json +- **Cookie** + rds-session: `` +- **Success Response:** + + - **Code:** 200 + + - **Content:** + + ```json + { + "message": "String", + "usersDetails": { + "count": Number, + "users": Array + } + + } + ``` + +- **Error Response:** + + - **Code:** 401 + + - **Content:** + ```json + { + "statusCode": 401, + "error": "Unauthorized", + "message": "Unauthenticated User." + } + ``` + + - **Code:** 500 + - **Content:** + ```json + { + "message": "The server has encountered an unexpected error. Please contact the administrator for more information." + } + ``` + +- **Example for updating an existing user documents:** + PATCH /migrations/addDefaultColorProperty
+ Content-Type: application/json
+ Request-Body:
+ None + Response : + Status 200 OK
+ Content-Type: application/json
+ + ```json + { + "usersDetails": { + "count": 3, + "users": ["ankur_1010", "ankur", "vivek"] + }, + "message": "User colors updated successfully!" + } + ``` From 057957b97c75feb5279c06f17470ef18ee123010 Mon Sep 17 00:00:00 2001 From: vivek lokhande Date: Sun, 6 Aug 2023 16:25:00 +0530 Subject: [PATCH 2/2] update formatting --- user-migrations/README.md | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/user-migrations/README.md b/user-migrations/README.md index 036fb966..057579e6 100644 --- a/user-migrations/README.md +++ b/user-migrations/README.md @@ -24,16 +24,20 @@ Adds a colors field to every exisiting user. - **Content:** - ```json - { - "message": "String", - "usersDetails": { - "count": Number, - "users": Array - } + ```json + { + "usersDetails": { + "totalUsersFetched": "Number", + "totalUsersUpdated": "Number", + "totalUsersUnaffected": "Number" + }, + "message": "String", + } + ```json - } - ``` + ``` + + ``` - **Error Response:** @@ -67,10 +71,13 @@ Adds a colors field to every exisiting user. ```json { + { "usersDetails": { - "count": 3, - "users": ["ankur_1010", "ankur", "vivek"] + "totalUsersFetched": 5, + "totalUsersUpdated": 2, + "totalUsersUnaffected": 3 }, "message": "User colors updated successfully!" } + } ```