Skip to content
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

Replace req["user"] with req["userEntity"] in the user.controller.ts #545

Closed
4 tasks
eleanorreem opened this issue Jul 22, 2024 · 2 comments
Closed
4 tasks
Assignees
Labels
complexity: moderate Time needed to do this ticket will be moderate e.g. 1-2 days help wanted Extra attention is needed javascript Pull requests that update Javascript code maintenance Maintenance / chore work priority: soon Should be prioritized soon. state: approved Ready to go. Not blocked or pending.

Comments

@eleanorreem
Copy link
Contributor

eleanorreem commented Jul 22, 2024

Overview

Take a read through the umbrella ticket. As a sub task to this ticket we want to phase out the use of req["user"] from the user.controller.ts. This most popular endpoint is GET /user/me. For a short period this endpoint will be less performant as the endpoint will be getting the full user profile twice: once in the AuthGuard and once when we hit the service. However, this hopefully will be solved swiftly as the refactor proceeds.

Action Items

  • In the user service, create a almost duplicate function user.getUserByFirebaseId and call it user.getUserProfile. getUserByFirebaseId will be refactored to only return the user and will be used by the FirebaseAuthguard. See detials blocked [ticket] (Refactor user fetching to remove unnessary joins #454). The difference between the two functions is that instead of using the firebaseId we can use the userId instead to get the user.
  • In the controller, use the service method user.getUserProfile rather than returning req["user"]. You will need to pass it req["userEntity"].id.
  • Replace all other instances in the controller of req["user"] with references to req["userEntity"]. These are found in DELETE /user and PATCH /user.
  • Run all tests. This includes Cypress tests as this endpoint is used everywhere.
@eleanorreem eleanorreem added complexity: moderate Time needed to do this ticket will be moderate e.g. 1-2 days priority: soon Should be prioritized soon. state: approved Ready to go. Not blocked or pending. maintenance Maintenance / chore work javascript Pull requests that update Javascript code labels Jul 22, 2024
@eleanorreem eleanorreem changed the title Replace req["user"] with req["userEntity"] in the GET /user/me Replace req["user"] with req["userEntity"] in the user.controller.ts Jul 22, 2024
@eleanorreem eleanorreem added the help wanted Extra attention is needed label Jul 22, 2024
@SangilYun
Copy link
Contributor

I'd like to work on this issue. Could you please assign it to me? Thank you!

Copy link

github-actions bot commented Aug 5, 2024

Thank you @SangilYun you have been assigned this issue!
Please follow the directions in our Contributing Guide. We look forward to reviewing your pull request shortly ✨


Support Chayn's mission? ⭐ Please star this repo to help us find more contributors like you!
Learn more about Chayn here and explore our projects. 🌸

@github-actions github-actions bot added the stale This issue or PR is inactive. label Sep 9, 2024
@kyleecodes kyleecodes removed the stale This issue or PR is inactive. label Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: moderate Time needed to do this ticket will be moderate e.g. 1-2 days help wanted Extra attention is needed javascript Pull requests that update Javascript code maintenance Maintenance / chore work priority: soon Should be prioritized soon. state: approved Ready to go. Not blocked or pending.
Projects
None yet
Development

No branches or pull requests

3 participants