haxxorsid/referralboard

Creating backend for Edit Profile

Closed this issue · 0 comments

Description

As a developer, I would like three different routes to update profile, update email, and update password. User would access these routes only when I am logged in. For update email, I will pass my new email, update my current company according to that email as well. For update password, I would pass my current password as well as new password.

I would like to see success and failure responses depending on the requests I have sent from the frontend.

Acceptance Criteria

  • Extract userId from the token in the cookie.
  • Update /api/users/id route to provide user details of the current logged in user.
  • Create a route /api/users/id/updateprofile to update user profile.
  • Create a route /api/users/id/updateemail to update user email.
  • Ensure the new email is unique and update CompanyId accordingly by adding additional checks for existing and non-existing company domain in Company table.
  • Create a route /api/users/id/updatepassword to update user password.
  • Ensure current password matches with the password in the database, only then update it with the new password.
  • Protect these 3 routes from unauthorized trigger.
  • Send appropriate success/error response if there are any issues in validation.
  • Create or Update Postman collection