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

Refactor the code #48

Merged
merged 10 commits into from
Aug 6, 2023
Merged

Refactor the code #48

merged 10 commits into from
Aug 6, 2023

Conversation

anjula-sack
Copy link
Member

@anjula-sack anjula-sack commented Aug 5, 2023

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

  • This PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.
  • I have read and understood the development best practices guidelines ( http://bit.ly/sef-best-practices )
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

Copy link
Member

@Piumal1999 Piumal1999 left a 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

src/configs/dbConfig.ts Show resolved Hide resolved
src/controllers/auth.controller.ts Outdated Show resolved Hide resolved
src/controllers/profile.controller.ts Outdated Show resolved Hide resolved
const user: Profile | undefined = req.user as Profile

const {
primary_email,
Copy link
Member

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

Copy link
Member Author

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)
Copy link
Member

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?

Copy link
Member Author

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

src/routes/profile/profile.route.test.ts Outdated Show resolved Hide resolved
Copy link
Member

@Piumal1999 Piumal1999 left a 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

@Piumal1999 Piumal1999 merged commit 9363aa4 into sef-global:main Aug 6, 2023
1 check passed
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 this pull request may close these issues.

2 participants