-
Notifications
You must be signed in to change notification settings - Fork 1
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
#160690389 remove username from required signup details and make it updateable #36
Conversation
- remove username requirement in req.body for user signup - automatically create username from firstname - remove tests that depend on presence of username in req.body [Delivers #160690389]
- make username updateable - add tests for this functionality - modify error handler to return custom error message param in next() [Delivers #160690389]
Pull Request Test Coverage Report for Build 436
💛 - Coveralls |
- add jsdoc for createUsername function - properly handle errors with the next() function [Fixes #160690389]
- properly test the createusername function [Delivers #160690389]
- remove unused argument when calling the createUsername method [Fixes #160690389]
- exclude user password from returned search data [Fixes #159204729]
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.
Well done, @madeofhuman.
I like how you created a separate method to help create a username for a new user in lieu of adding the logic to the signup user method. This makes the code neat.
However, I feel you should also create a method or mechanism to ensure that the username is always unique and belongs to a single user. This is because the username field on our User model has a unique constraint and if a user tries to update their profile with a username which already belongs to another user the operation/database will crash.
Please endeavour to resolve this.
Good job.
- return an error when user tries to update their username to an already exisiting one - increase test timeout to accommodate slow network calls [Fixes #160690389]
Thanks for pointing that out, @chukwuemekachm . I have fixed it. |
- test more edge cases for username update [Delivers #160690389]
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.
Welldone @madeofhuman.
- remove username requirement in req.body for user signup - automatically create username from firstname - remove tests that depend on presence of username in req.body [Delivers #160690389]
- make username updateable - add tests for this functionality - modify error handler to return custom error message param in next() [Delivers #160690389]
- add jsdoc for createUsername function - properly handle errors with the next() function [Fixes #160690389]
- properly test the createusername function [Delivers #160690389]
- remove unused argument when calling the createUsername method [Fixes #160690389]
- exclude user password from returned search data [Fixes #159204729]
- return an error when user tries to update their username to an already exisiting one - increase test timeout to accommodate slow network calls [Fixes #160690389]
- test more edge cases for username update [Delivers #160690389]
…ndela/elven-ah into feature/160690389/user-update-username
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.
@madeofhuman Good job here! @chukwuemekachm has raised the only concern I had and you have fixed that. So kudos and keep it up!
…ndela/elven-ah into feature/160690389/user-update-username
…ndela/elven-ah into feature/160690389/user-update-username
6575255
to
49f9617
Compare
@madeofhuman change the base branch to develop |
- remove username requirement in req.body for user signup - automatically create username from firstname - remove tests that depend on presence of username in req.body [Delivers #160690389]
- make username updateable - add tests for this functionality - modify error handler to return custom error message param in next() [Delivers #160690389]
- add jsdoc for createUsername function - properly handle errors with the next() function [Fixes #160690389]
- properly test the createusername function [Delivers #160690389]
- remove unused argument when calling the createUsername method [Fixes #160690389]
- exclude user password from returned search data [Fixes #159204729]
- return an error when user tries to update their username to an already exisiting one - increase test timeout to accommodate slow network calls [Fixes #160690389]
- test more edge cases for username update [Delivers #160690389]
- remove username requirement in req.body for user signup - automatically create username from firstname - remove tests that depend on presence of username in req.body [Delivers #160690389]
- add jsdoc for createUsername function - properly handle errors with the next() function [Fixes #160690389]
- test more edge cases for username update [Delivers #160690389]
- update callback url for Facebook and Google [Fixes #160056182]
…ndela/elven-ah into feature/160690389/user-update-username
I have done that. I had to rebase on develop first. @tonymontaro |
…ndela/elven-ah into feature/160690389/user-update-username
…ndela/elven-ah into feature/160690389/user-update-username
- add more test for username update [Fixes #160690389]
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.
Nice work!
What does this PR do?
Removes the username property from required data for user signup, automatically create a username for the user from their first name, and make the username property updateable
Description of Task to be completed?
How should this be manually tested?
.env.example
to fill in the.env
filenpm install
npm start
/api/v1/auth/signup
and create an account with the propertiesfirstName
,lastName
,email
,password
, andconfirmPassword
. The username property will be automatically generated from your first name and added to your user details on creation./api/v1/users/:username
and update your profile with the propertiesfirstName
,lastName
,email
,username
,password
, andconfirmPassword
. Note that your email address will cannot be changed.Any background context you want to provide?
What are the relevant pivotal tracker stories?
Screenshots (if appropriate)
N/A
Questions:
N/A
[Delivers #160690389]