-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nsc-events-nestjs_Sprint-1_Restrict-Access-to-User-Routes_34 #35
Conversation
Since all routes can be guarded from a top level authGuard which trickles down to all of the below user routes. Deleted un-needed authguards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Jeremy, the code looks good but CI/CD is failing because the test is not implemented. Please uncomment and update the test. Review the activity controller test if needed.
Added Jest Mock testing for the user routes.
Added Jest Mock Tests
I have uploaded a Jest mock test which should hopefully fix this issue. |
@theGaryLarson looks like there was an update to this PR. Are the changes requested now satisfied? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I ran through all of your screenshots and was able to get the same results. Pretty cool! So it seems like this pretty much gives admins control over user creation, updates and deletes while guarding these actions from other users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, and thank you for providing some pictures!
I'm able to create/update/delete an account using the proper endpoints.
This is minor and can be added later but I'd recommend providing a message for the update and delete endpoints (primarily for the admin/creator)
Yeah I didn't know what best practice was in this case to I just left it with the response 200 code. |
Looks like some checks still aren't going through with the CI/CD. I just re-ran the tests in case something got hung up (it happens sometimes) but that wasn't the case. Maybe troubleshooting this with @theGaryLarson tonight would be a good idea. |
Reopened and fixed the checks. Just need to confirm that @theGaryLarson is satisfied per the pending change request. |
Merging PR as per BC's instructions. Will need a re-review by lead dev.
Since all routes can be guarded from a top level authGuard I added the imports and then the authguard on line 20, since we also already have a jwt.strategy written I just used that for the auth. All of this trickles down to all of the below user routes. Proceeded to deleted un-needed authguards.
EDIT, added tests for these routes.
Closes #34
Here are tests,
use the signup route and use the token retrieved to login to the next routes.

Attempt to create a user without auth.

Create a user with auth.

Attempt to update a user without auth.

Attempt to update a user with auth token.

Attempt to delete a user without Auth.

Attempt to delete a user with auth.
