-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Refactor the code #48
Conversation
b5061db
to
c917f97
Compare
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.
Thanks @anjula-sack
I added some comments
const user: Profile | undefined = req.user as Profile | ||
|
||
const { | ||
primary_email, |
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.
If we are allowing the users to change the primary email, we have to do some additional validation to check whether that email is not associated with another profile
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.
primary_email is unique at the DB level. It will throw an error. But that error is not user friendly.
|
||
res.status(200).json(updatedProfile.raw[0]) | ||
} catch (err) { | ||
console.error('Error executing query', err) |
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.
Can we keep some pre-defined set of common exceptions as we did in the previous version?
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.
yeah that's better, let's tackle it in a separate issue
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.
Good job @anjula-sack
Thank you
Purpose
The purpose of this PR is to fix test running issues and refactor the code
Goals
Refactor the code
Approach
Refactored the code
Screenshots
Checklist