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#82 POST and GET /user/personal_background api endpoints #83

Conversation

mtreacy002
Copy link
Member

@mtreacy002 mtreacy002 commented Jul 16, 2020

Description

Give user the ability to create and get their personal background information.

Fixes #82

Type of Change:

  • Code

Code/Quality Assurance Only

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

How Has This Been Tested?

  • Tested manually by sending POST /user/personal_background (to create personal background of existing user).
  • on successful output - personal background information successfully created:
    Screen Shot 2020-07-16 at 5 51 42 pm

  • when user already has existing personal background information in the database:
    Screen Shot 2020-07-16 at 5 53 42 pm

  • tested manually by sending GET /user/personal_background (to get their personal background information):
  • on successful output:
    Screen Shot 2020-07-16 at 4 52 26 pm

  • on error response - user has no personal background information in the database:
    Screen Shot 2020-07-16 at 3 54 32 pm

Checklist:

  • My PR follows the style guidelines of this project
  • I have performed a self-review of my own code or materials
  • I have commented my code or provided relevant documentation, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

Code/Quality Assurance Only

  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been published in downstream modules

Additional note

  • Test cases will be done on a separate PR.
  • Personal Background enum input must be taken from the Background enum VALUE from within app/utils/bitschema_utils.py file.

@mtreacy002 mtreacy002 requested review from ramitsawhney27 and a team July 16, 2020 08:11
@mtreacy002 mtreacy002 self-assigned this Jul 16, 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 16, 2020
@mtreacy002 mtreacy002 added this to the GSoc Coding Phase 2 milestone Jul 16, 2020
@mtreacy002
Copy link
Member Author

Update @ramitsawhney27 and @anitab-org/bridgeintech-maintainers . Here's PR for POST and GET /user/personal_background api endpoints. The test cases will be submitted separately. Look forward to hear your feedback.

@mtreacy002 mtreacy002 force-pushed the issue#82-post-get-user-personal-background-api branch from 2a8bc3f to 02a6ad3 Compare July 18, 2020 13:18
ramitsawhney27
ramitsawhney27 previously approved these changes Jul 19, 2020
Copy link

@ramitsawhney27 ramitsawhney27 left a comment

Choose a reason for hiding this comment

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

This PR (+the tests) look coherent. Good work!

@mtreacy002
Copy link
Member Author

This PR (+the tests) look coherent. Good work!

Thanks, @ramitsawhney27

@mtreacy002 mtreacy002 added the Status: On Hold Issue or PR needs more info, a discussion, a review or approval from a Maintainer/Code Owner. label Jul 19, 2020
@mtreacy002 mtreacy002 changed the title Feat: Issue#82 POST and GET /user/personal_background api endpoints WIP | Feat: Issue#82 POST and GET /user/personal_background api endpoints Jul 19, 2020
@mtreacy002 mtreacy002 force-pushed the issue#82-post-get-user-personal-background-api branch 2 times, most recently from 3099657 to 5235660 Compare July 22, 2020 03:49
@mtreacy002 mtreacy002 changed the title WIP | Feat: Issue#82 POST and GET /user/personal_background api endpoints Feat: Issue#82 POST and GET /user/personal_background api endpoints Jul 22, 2020
@mtreacy002 mtreacy002 removed the Status: On Hold Issue or PR needs more info, a discussion, a review or approval from a Maintainer/Code Owner. label Jul 22, 2020
@mtreacy002
Copy link
Member Author

Update @anitab-org/bridgeintech-maintainers . I've modified background enum logic as per our discussion on BIT weekly meeting. Please re-rerview. Thanks

@mtreacy002 mtreacy002 requested review from ramitsawhney27 and a team July 22, 2020 03:57
ramitsawhney27
ramitsawhney27 previously approved these changes Jul 22, 2020
@mtreacy002
Copy link
Member Author

Update @anitab-org/bridgeintech-maintainers . I've just force pushed changes to add other fields for physical and mental ability as well as socio-economic status.

@mtreacy002 mtreacy002 force-pushed the issue#82-post-get-user-personal-background-api branch from 62139e4 to a700663 Compare July 26, 2020 07:34
@mtreacy002
Copy link
Member Author

Update @anitab-org/bridgeintech-maintainers . I've solved merge conflict, fix bug as mentioned on zulip post, and temporarily fix bug as reported on issue #94 (similar approach also applied on PR #80).
Can you please re-review when you have time? Thanks

ramitsawhney27
ramitsawhney27 previously approved these changes Jul 29, 2020
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.

PR81 for issue80 was reviewed and tested. @mtreacy002
review the following conflicting files when you have time 👍

@mtreacy002
Copy link
Member Author

@ramitsawhney27 and @foongminwong, I've resolved the merged conflicts. I think you both need to re-approve it again as your previous approvals were removed by the force pushed.

ramitsawhney27
ramitsawhney27 previously approved these changes Jul 31, 2020
@foongminwong
Copy link

@mtreacy002
When I tried to test POST /user/personal_background using the following input:

{
  "gender": "MALE",
  "age": "DECLINED",
  "ethnicity": "DECLINED",
  "sexual_orientation": "DECLINED",
  "religion": "DECLINED",
  "physical_ability": "DECLINED",
  "mental_ability": "DECLINED",
  "socio_economic": "DECLINED",
  "highest_education": "DECLINED",
  "years_of_experience": "DECLINED",
  "gender_other": "DECLINED",
  "ethnicity_other": "NOT_APPLICABLE",
  "sexual_orientation_other": "DECLINED",
  "religion_other": "DECLINED",
  "physical_ability_other": "DECLINED",
  "mental_ability_other": "DECLINED",
  "socio_economic_other": "DECLINED",
  "highest_education_other": "DECLINED",
  "is_public": true
}

I got the following response:

test-pr-83-post-output

Do you know which personal background fields input provided is/are not within the given list.?

@mtreacy002
Copy link
Member Author

mtreacy002 commented Jul 31, 2020

@foongminwong . As per our last week discussion on the enum logic all pushed to backend, the input fields now only take background VALUE instead of their Keys. So, your input instead of DECLINED should be Prefer not to say. (Note: It's the same as POST. or PUT /user/additional_info where you give Timezone input in its enum value)
Note @anitab-org/bridgeintech-maintainers. I'll add this info in the API endpoint details so collaborator awaree of this.

Refactor Background enum logic

Add other fields for physical, mental and socio-economic

Fix: bug on user_id not retrieved error message and setting cookie

Add info on enum value as input on POST /user/personal_background api endpoint
@mtreacy002
Copy link
Member Author

Update @anitab-org/bridgeintech-maintainers . I've just force pushed with the change on POST /user/personal_background doc string that Background enum input needs the enum VALUE. @ramitsawhney27 and @foongminwong , can you please re-approve? Thanks

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

  2. All possible responses were tested as below:

    • POST /user/personal_background
      Screenshot/gif/url:

      test-pr-83-create-personal-bg-and-view

      Description: Above gif output shows users who added their personal background and viewed after that.
      Expected Result: As a user, I should be able to create my personal background.
      Actual Result: Same as expected
      Json:

{
  "gender": "Prefer not to say",
  "age": "Prefer not to say",
  "ethnicity": "Prefer not to say",
  "sexual_orientation": "Prefer not to say",
  "religion": "Prefer not to say",
  "physical_ability": "Prefer not to say",
  "mental_ability": "Prefer not to say",
  "socio_economic": "Prefer not to say",
  "highest_education": "Prefer not to say",
  "years_of_experience": "Prefer not to say",
  "gender_other": "Prefer not to say",
  "ethnicity_other": "Prefer not to say",
  "sexual_orientation_other": "Prefer not to say",
  "religion_other": "Not Applicable",
  "physical_ability_other": "Not Applicable",
  "mental_ability_other": "Not Applicable",
  "socio_economic_other": "Not Applicable",
  "highest_education_other": "Not Applicable",
  "is_public": true
}
  • GET /user/personal_background
    Screenshot/gif/url:

    test-pr-83-no-personal-bg

    Description: Above gif output shows a person who does not have any personal background.
    Expected Result: As a user, I should be able to retrieve my personal background.
    Actual Result: Same as expected

  1. OS Version: Windows 10

@foongminwong foongminwong merged commit b7c3797 into anitab-org:develop Aug 1, 2020
@mtreacy002 mtreacy002 deleted the issue#82-post-get-user-personal-background-api branch August 30, 2020 11:42
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: POST and GET /user/personal_background api endpoints
3 participants