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

Storing userData in place of userId in progresses to minimize additional API calls from the frontend. #2309

Conversation

AnujChhikara
Copy link

@AnujChhikara AnujChhikara commented Dec 20, 2024

Date: 20 Dec 2024

Developer Name: Anuj Chhikara


Issue Ticket Number

#2294

Description

In this PR, we have updated the logic for storing user-related information when a progress is created. Previously, only the userId was stored, but now we are storing the complete userData object. This change ensures that more comprehensive user details are available directly within the progress data, reducing the need for additional API calls to fetch user information from the frontend.

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

Screenshot 1

Post Request working fine

  • Without dev flag
Postman Image 1 Postman Image 2
  • With dev flag
    userData field getting add in place of userId
Postman Image 1 Postman Image 2

Test Coverage

Screenshot 1

image
image
image

Additional Notes

  • Updated addUser Function:
    The addUser function in the utils previously only returned userId. To support storing userData in progresses, I added a second argument (defaulted to false). When set to true, the function now returns userData, which we use in tests to store the full user data in the progress documents.

@vikasosmium vikasosmium marked this pull request as ready for review December 20, 2024 16:31
@AnujChhikara AnujChhikara changed the title Replace userId with userData in progresses to minimize additional API calls from the frontend. Storing userData in place of userId in progresses to minimize additional API calls from the frontend. Dec 20, 2024
@yesyash
Copy link
Contributor

yesyash commented Dec 20, 2024

  • if we're storing user data in the progress model how do we plan to update it if the user details change?
  • can we not query the user details in the controller with the help of user id and pass it to frontend instead of storing the user in the progress document?

@AnujChhikara
Copy link
Author

design doc

@AnujChhikara AnujChhikara marked this pull request as draft December 21, 2024 03:30
@AnujChhikara
Copy link
Author

Closing this PR as I didn’t consider some of the disadvantages earlier but will keep them in mind moving forward. Apologies for the oversight

@AnujChhikara AnujChhikara deleted the feature/replace-userId-with-userData branch December 21, 2024 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants