-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add manager profile editing functionality #8
base: main
Are you sure you want to change the base?
Add manager profile editing functionality #8
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal is to update only the name. Please make changes accordingly. Only the manager themself will access this API. Therefore, userRole 0 is the only role authorised to use this route. Update logic to support that.
controller/userWebController.js
Outdated
"managerEmail" : "<managerEmail>", | ||
"managerPassword" : "<managerPassword>", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The password
update will happen thru forget password and this. Insecure way! Also, email cannot be updated by the manager.
controller/userWebController.js
Outdated
"managerRole" : "<0/1>", | ||
"accountStatus" : "<0/1/2>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even this too. Only name can be edited.
controller/userWebController.js
Outdated
*/ | ||
webTokenValidator, | ||
async (req, res) => { | ||
if (req.body.userRole === null || req.body.userRole === undefined || req.body.userRole === "" || (req.body.userRole !== "1" && req.body.userRole !== "0" && req.body.userRole !== "2") || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is for the manager to update by themselves. hence userRole can only be 0
.
Ohh ok, I'll change it |
@Ashrockzzz2003, since only the name is being edited should I do all these checks or should I only validate the name of the manager and only pass the name of the manager in the request body? |
The request body only will have the updated name.
|
So a manager can only change his own name or they can change anyone's name? If they are allowed to change anyone's name should'nt the id also be passed in the request body? |
Yes |
I'll add it |
@Ashrockzzz2003 I have made the changes |
Add API for Updating Manager Profile
Description
This pull request adds an API endpoint
editManagerProfileById
, which allows authorized user to update a manager's profileFeatures
/manager/profile/edit
This PR handles issue #4
Please review @Ashrockzzz2003