North-Seattle-College / ad440-winter2021-thursday-repo

NSC AD 440 Winter 2021 Thursday cohort practicum repo
Apache License 2.0
2 stars 27 forks source link

Invalidating cache for user/{user_id} endpoint with modifications for the GET, PUT and DELETE method #231

Closed chonger878 closed 3 years ago

chonger878 commented 3 years ago

Closes #191

This PR: -Includes modification for PUT and DELETE methods for the user/{user_id} endpoint -Includes a canValidate() method that can ensure the user is not deleting/replacing data from a cache that is empty/has duplicate values -I have turned the REDIS_HOST and REDIS_PORT into os.environ variables so that different ports/hosts can use this- no longer hardcoded values.

This was the work of two contributors.

TESTING DOCUMENTATION

Before you test, please make sure under 'REDIS_HOST' and 'REDIS_PORT', please specify which ports and hosts you would like to use

1.)If you have VSC code open and navigated to your function, go ahead and run/debug 2.) Open Postman 3.) Run GET 4.) Your expected output on VSC should be the logs and that the results were all cached 5.)Run PUT 6.) Your expected output on VSC should be the same as above, except you will get a message that the cache was updated/unable to update, and a user_id should automatically generate in that SQL table. a.) Enter whatever you like for first name, last name, email address b.) You could also make an incomplete entry (like missing first name, email) to see if you get an error message. 7.) Run DELETE 8.)You should get a message that your cache has been cleared or deletion was failed.

Special thanks to PR #223 to help me with working on these documentations.