-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
technical notes for testing and usage added
- Loading branch information
1 parent
37c8e23
commit 02a6577
Showing
4 changed files
with
434 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
PART 1 | ||
|
||
SOLUTION 1 | ||
User can archive ir dearchive other users | ||
|
||
curl --header \ | ||
"Authentication: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxfQ.JC6qKuH9SG0SIiYSfhZUFTtirxN9Q47buLk0DPFFFzE" \ | ||
--header "Content-Type: application/json" \ | ||
-X PUT -d '{"user":{"email":"[email protected]","is_archived":"true"}}' \ | ||
http://localhost:3189/users/1 | ||
|
||
|
||
RESULT: | ||
|
||
earth@earth:~/Downloads/test_tasks/staffomatic_user_management$ curl --header \ | ||
> "Authentication: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxfQ.JC6qKuH9SG0SIiYSfhZUFTtirxN9Q47buLk0DPFFFzE" \ | ||
> --header "Content-Type: application/json" \ | ||
> -X PUT -d '{"user":{"email":"[email protected]","is_archived":"true"}}' \ | ||
> http://localhost:3189/users/1 | ||
{"email":"[email protected]","is_archived":true,"id":1,"password_digest":"$2a$12$FB/RKx0T4M60qfqLJ7c4dOsZcdDNVtvSnWHQjKSKrAcy1NOi7S8fi","created_at":"2022-09-12T16:56:16.038Z","updated_at":"2022-09-12T18:48:38.503Z"}earth@earth:~/Downloads/test_tasks/staffomatic_user_management$ | ||
|
||
|
||
create more users to update: | ||
|
||
curl --request POST --header "Content-Type: application/json" \ | ||
http://localhost:3189/signup --data \ | ||
'{"data": {"attributes": {"email": "[email protected]", "password": "welcome", "password_confirmation": "welcome"}}}' | ||
|
||
|
||
111111111111111111111111111111111111111111111111111111111111111111111 | ||
|
||
SOLUTION 2 | ||
|
||
1 create user | ||
|
||
|
||
curl --request POST --header "Content-Type: application/json" \ | ||
http://localhost:3189/signup --data \ | ||
'{"data": {"attributes": {"email": "[email protected]", "password": "welcome", "password_confirmation": "welcome"}}}' | ||
|
||
|
||
2 delete user | ||
|
||
curl --header \ | ||
"Authentication: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxfQ.JC6qKuH9SG0SIiYSfhZUFTtirxN9Q47buLk0DPFFFzE" \ | ||
--header "Content-Type: application/json" \ | ||
-X DELETE http://localhost:3189/users/5 | ||
|
||
|
||
|
||
|
||
|
||
11111111111111111111111111111111111111111111111111111111111111111111111111 | ||
|
||
|
||
SOLuTION 3 | ||
|
||
1 create user | ||
|
||
|
||
curl --request POST --header "Content-Type: application/json" \ | ||
http://localhost:3189/signup --data \ | ||
'{"data": {"attributes": {"email": "[email protected]", "password": "welcome", "password_confirmation": "welcome"}}}' | ||
|
||
|
||
2 delete user | ||
|
||
curl --header \ | ||
"Authentication: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxfQ.JC6qKuH9SG0SIiYSfhZUFTtirxN9Q47buLk0DPFFFzE" \ | ||
--header "Content-Type: application/json" \ | ||
-X DELETE http://localhost:3189/users/2 | ||
|
||
|
||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
||
|
||
|
||
|
||
SOLUTION 4 | ||
|
||
for is archived true | ||
|
||
|
||
curl -X GET \ | ||
-H "Content-type: application/json" \ | ||
-H "Authentication: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxfQ.JC6qKuH9SG0SIiYSfhZUFTtirxN9Q47buLk0DPFFFzE" \ | ||
-d '{"filter": {"is_archived": "true"}}' \ | ||
"http://localhost:3189/users" | ||
|
||
|
||
for its arcive false | ||
|
||
|
||
curl -X GET \ | ||
-H "Content-type: application/json" \ | ||
-H "Authentication: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxfQ.JC6qKuH9SG0SIiYSfhZUFTtirxN9Q47buLk0DPFFFzE" \ | ||
-d '{"filter": {"is_archived": "true"}}' \ | ||
"http://localhost:3189/users" | ||
|
||
|
||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
Oops, something went wrong.