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

PATCH /users/self controller is ambiguous, and slow. #2155

Open
6 of 10 tasks
shubhdevelop opened this issue Sep 14, 2024 · 0 comments
Open
6 of 10 tasks

PATCH /users/self controller is ambiguous, and slow. #2155

shubhdevelop opened this issue Sep 14, 2024 · 0 comments
Assignees

Comments

@shubhdevelop
Copy link
Contributor

shubhdevelop commented Sep 14, 2024

Issue Description

PATCH /users/self is going to be deprecated` but the controller logic stays.

The Patch /users/self routes, doesn't allow the developers to update their profile data.
By developers we mean those users who are in the discord server, whom user Details is not incomplete and have developers role added to them.
For user to update their profile data we suggest them to use Profile service.

we are fetching all the user in RDS server from the discord, in order to check if the user has developer role or not , using the discord service, this shoots up the response time in certain cases, the latency is in magnitude of O(n) where n is the number of users currently in the discord service

Expected Behaviour

If a request is made to the route PATCH /users/self with some data in the body: partial<UserObject> it is the expectation that it should update user data with all that is being sent in the body .

Fast Response Time

Current Behaviour

If we send a request with object

body: {
      username:string
}

it return can't update the username twice -> expected

body:{
   roles:{
         super_user: true/false
  }
}

it return can't modify roles --> expected

For other properties we don't allow users to update their profile data, if the user is a developer, (in_discord==true && !userDetailsIncomplete). then we fetch all the user from discrod server and check if the current logged in users discordId is equal to the discord.user.id. in worst case this the it take up to O(n) time if the user returned is found to be at end.

ps: this route is generally used to add details to user once they are signed up or has their userDetailsIncomplete property true.

Flow

image

Reproducibility

  • This issue is reproducible
  • This issue is not reproducible

Steps to Reproduce

send the objects mentioned in current behavior section on PATCH /users/self.

Severity/Priority

  • Critical
  • High
  • Medium
  • Low

Additional Information

Checklist

  • I have read and followed the project's code of conduct.
  • I have searched for similar issues before creating this one.
  • I have provided all the necessary information to understand and reproduce the issue.
  • I am willing to contribute to the resolution of this issue.
@shubhdevelop shubhdevelop changed the title The PATCH /users/self route is ambiguous [fix] The PATCH /users/self route is ambiguous, and high response time. Sep 20, 2024
@shubhdevelop shubhdevelop changed the title [fix] The PATCH /users/self route is ambiguous, and high response time. The PATCH /users/self route is ambiguous, and high response time. Sep 20, 2024
@ankushdharkar ankushdharkar changed the title The PATCH /users/self route is ambiguous, and high response time. PATCH /users/self route is ambiguous and slow Sep 20, 2024
@shubhdevelop shubhdevelop changed the title PATCH /users/self route is ambiguous and slow The PATCH /users/self route is ambiguous, and slow. Sep 20, 2024
@ankushdharkar ankushdharkar changed the title The PATCH /users/self route is ambiguous, and slow. PATCH /users/self route is ambiguous, and slow. Sep 20, 2024
@shubhdevelop shubhdevelop changed the title PATCH /users/self route is ambiguous, and slow. The /users/self route is ambiguous, and slow. Sep 20, 2024
@ankushdharkar ankushdharkar changed the title The /users/self route is ambiguous, and slow. PATCH /users/self route is ambiguous, and slow. Sep 20, 2024
@shubhdevelop shubhdevelop changed the title PATCH /users/self route is ambiguous, and slow. PATCH /users/self controller is ambiguous, and slow. Sep 21, 2024
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 a pull request may close this issue.

1 participant