Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Improvements
We could improve the routes now that we are using JWT tokens and limit API resource access.
For example:
Currently, if you are logged in, you can search for a user using the
get user by id route
by passing another user's ID as a query parameter.This happens because the route uses the JWT token just for authentication and not to search for the user.
This would also prevent us from needing to export the
userId
from the create-authenticate-user.ts file, which is used for our tests, and to complete the route path (through query parameters) in the tests.Also, we should not return user info in the /login route, but that request needs to be aligned with the front-end, @pedrodecf.
These improvements are not done yet since they will require changing the URLs that the front-end sends to us. We are one day away from delivering the project, and including this PR, the routes are safe and without any security leaks.
Let's open an issue in the frontend and backend to address this smoothly
https://github.com/MatheusSanchez/orange-front