Update edit user endpoint

This commit is contained in:
Alex Holliday committed 2024-07-24 11:33:20 -07:00
1 parent b39e80b9da
commit 6db9a2f960
1 file changed
+29 -24
+29 -24
View File
@@ -433,18 +433,20 @@ curl --request POST \
###### Method/Headers ###### Method/Headers
> | Method/Headers | Value | > | Method/Headers | Value |
> | -------------- | ----- | > | -------------- | ------------------- |
> | Method | POST | > | Method | POST |
> | content-type | multipart/form-data |
##### Body ##### Form
> | Name | Type | Notes | > | Name | Type | Notes |
> | ------------- | -------- | ----------- | > | ----------- | -------- | --------------------------- |
> | firstname | `string` | | > | firstName | `string` | Optional |
> | lastname | `string` | | > | lastName | `string` | Optional |
> | profilePicUrl | `string` | | > | profileIame | `file` | Optional |
> | password | `string` | Min 8 chars | > | password | `string` | Required to change password |
> | newPassword | `string` | Required to change password |
###### Response Payload ###### Response Payload
@@ -456,13 +458,14 @@ curl --request POST \
``` ```
curl --request POST \ curl --request POST \
--url http://localhost:5000/api/v1/auth/user/6654d156634754f789e1f10e \ --url http://localhost:5000/api/v1/auth/user/66a1425b873da2207443f192 \
--header 'Authorization: <bearer_token>' \ --header 'Authorization: <bearer_token>' \
--header 'Content-Type: application/json' \ --header 'Content-Type: multipart/form-data' \
--data '{ --form firstName=Test \
"firstname": "First Name", --form lastName=Test \
"lastname: "Last Name" --form profileImage=@/home/user/Desktop/cat.jpg \
}' --form 'newPassword=Testtest1!' \
--form 'password=Testtest2!'
``` ```
###### Sample Response ###### Sample Response
@@ -470,17 +473,19 @@ curl --request POST \
```json ```json
{ {
"success": true, "success": true,
"msg": "User updated", "msg": "User updated successfully",
"data": { "data": {
"_id": "6654d156634754f789e1f10e", "_id": "66a1425b873da2207443f192",
"firstname": "First Name", "firstName": "First name",
"lastname": "Last Name", "lastName": "Last name",
"email": "me@gmail.com", "email": "name@gmail.com",
"isActive": true, "isActive": true,
"isVerified": false, "isVerified": false,
"createdAt": "2024-05-27T18:30:46.358Z", "role": ["admin"],
"updatedAt": "2024-05-27T19:21:51.747Z", "createdAt": "2024-07-24T18:05:15.852Z",
"__v": 0 "updatedAt": "2024-07-24T18:31:32.314Z",
"__v": 0,
"avatarImage": "<Base64 Image>"
} }
} }
``` ```