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

Feat: issue#63 - GET /user/personal_details api endpoint and tests #71

Merged

Conversation

mtreacy002
Copy link
Member

@mtreacy002 mtreacy002 commented Jul 7, 2020

Description

Add API endpoint for GET/user profile and test cases

Fixes #72 as well as part of issue #63

Type of Change:

  • Code
  • Quality Assurance

Code/Quality Assurance Only

  • New feature (non-breaking change which adds functionality pre-approved by mentors)

How Has This Been Tested?

  • tested functionality by running the application manually
  • run test on VSCode Tests explorer - result: all passed
  • run unittest on the terminal - result: all passed

Checklist:

  • My PR follows the style guidelines of this project
  • I have performed a self-review of my own code or materials

Code/Quality Assurance Only

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@mtreacy002 mtreacy002 requested review from ramitsawhney27 and a team July 7, 2020 16:39
ramitsawhney27
ramitsawhney27 previously approved these changes Jul 7, 2020

def post_request(request_url, data):
def post_request(request_string, data):
request_url = f"{BASE_MS_API_URL}" + request_string

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify as:
f”{BASE_MS_API_URL}{request_string}”

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@mtreacy002 mtreacy002 changed the title Feat: issue#62 - GET /user api endpoint and tests Feat: issue#63 - GET /user api endpoint and tests Jul 8, 2020
@mtreacy002
Copy link
Member Author

Update @anitab-org/bridgeintech-maintainers . I've fixed the title of this PR. It should be addressing issue #63 instead of #62. I'll do #62 next.

@mtreacy002
Copy link
Member Author

PS: I need to open a new branch for issue #62 and will need to carry this PR code changes across. I'll squashed merge it now so it won't be a problem later on.

@mtreacy002 mtreacy002 force-pushed the issue62-create-user-profile branch 2 times, most recently from b2e01a2 to 663de70 Compare July 8, 2020 11:42
@mtreacy002 mtreacy002 self-assigned this Jul 8, 2020
@mtreacy002 mtreacy002 added Category: Coding Changes to code base or refactored code that doesn't fix a bug. Program: GSOC Related to work completed during the Google Summer of Code Program. labels Jul 8, 2020
@mtreacy002
Copy link
Member Author

Update @anitab-org/bridgeintech-maintainers . I've just forced push last fix for f-string referred by @ramitsawhney27 above that I missed (on get_request function).

@mtreacy002
Copy link
Member Author

mtreacy002 commented Jul 8, 2020

@ramitsawhney27 . Atm, this code change on this PR only getting user from user table on MS schema. do you want me to also add the do the BIT schema DAO side on this PR as well or open a new one for that?

Screen Shot 2020-07-08 at 11 32 59 pm

@mtreacy002
Copy link
Member Author

But perhaps, the BIT DAO can be done after update user profile, since BIT DAO will only have data after user update their profile which is for issue #62. I'll leave this PR as it is then (only GET /user on MS public) and will open a separate issue for GET /user that calls BIT DAO user_extension and personal_background

@mtreacy002
Copy link
Member Author

mtreacy002 commented Jul 8, 2020

Update @anitab-org/bridgeintech-maintainers. As per MVP mockups on User My Profile page, I'll separate GET, PUT, DELETE for user profile into 3 sub-urls:

  1. /user/personal_details (data source: User table on public (MS) schema)

Screen Shot 2020-07-09 at 1 23 52 am

  1. /user/additional_information (data source: User_extension table on bitschema)

Screen Shot 2020-07-09 at 1 24 03 am

  1. /user/personal_background (data_source: Personal_background table on bitschema)

Screen Shot 2020-07-09 at 1 24 19 am

This PR will only deal with GET /user/personal_details. I'll create separate issues for the other 2 GET sub-urls.

@mtreacy002 mtreacy002 force-pushed the issue62-create-user-profile branch from 663de70 to 4d9ab8c Compare July 9, 2020 00:32
@mtreacy002
Copy link
Member Author

Update @anitab-org/bridgeintech-maintainers . I've just pushed forced the changes to fix request url /user to /user/personal_details as per discussion above.

@mtreacy002
Copy link
Member Author

Now this PR is complete and any changes will be made in the next PR. Please re-review. @anitab-org/bridgeintech-maintainers

@mtreacy002 mtreacy002 changed the title Feat: issue#63 - GET /user api endpoint and tests Feat: issue#63 - GET /user/personal_details api endpoint and tests Jul 9, 2020
@mtreacy002
Copy link
Member Author

Update: just came across a bug on this PR... will fix and push another commit soon @anitab-org/bridgeintech-maintainers

@mtreacy002 mtreacy002 force-pushed the issue62-create-user-profile branch from 4d9ab8c to e93f1d9 Compare July 9, 2020 03:19
@mtreacy002
Copy link
Member Author

Update @anitab-org/bridgeintech-maintainers . I fixed the bug. Now it's ready for re-review 😉

Copy link

@foongminwong foongminwong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes made in this PR were tested locally. Following are the results:

  1. Code review - Done by @ramitsawhney27

  2. All possible responses were tested as below (tap/zoom in to see clearer gifs):

GET /user/personal_details on BIT API Expected Result Actual Result
test-pr-bit-backend-71-success As a user, I am able to view my personal details when I enter a correct access token.
test-pr-bit-backend-71-invalid token As a user, I will get a token invalid error when I enter an incorrect access token.
test-pr-bit-backend-71-internal-server-error As a user, I will get an internal server error when I stop running MS backend locally
  1. Additional testcases covered: N/A

  2. Additional Comments:

  1. OS Version: Windows 10

@mtreacy002
Copy link
Member Author

Thanks for the review, @foongminwong. @ramitsawhney27 . can you please re-approve this PR? your previous approval got dismissed when I did the force pushed 😁

@ramitsawhney27 ramitsawhney27 merged commit 741ea33 into anitab-org:develop Jul 9, 2020
@mtreacy002 mtreacy002 deleted the issue62-create-user-profile branch July 21, 2020 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Coding Changes to code base or refactored code that doesn't fix a bug. Program: GSOC Related to work completed during the Google Summer of Code Program.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dev: GET /user/personal_details api endpoint and tests
3 participants