mentorship-backend icon indicating copy to clipboard operation
mentorship-backend copied to clipboard

Add to List Users API the ability to filter users by location

Open paritoshsinghrahar opened this issue 4 years ago • 15 comments

Description

As a member of the app, I need be able to filter other members by their location, so that I can choose the member I want to create a mentorship relation with.

APIs used to fetch Users, don't have an option to filter users by location attribute.

Note: This issue is labeled for Open Source Hack.

I can assign this issue to you on September 1st as the official opening date for Open Source Hack. Please free to check out other issues in the meantime. Program website: https://anitab-org.github.io/events/open-source-hack/

Acceptance Criteria

Update [Required]

  • [ ] Add a query parameter support to GET /users and GET /users/verified, to filter users by location attribute.
  • [ ] Update Swagger UI documentation for this API.
  • [ ] Write at least one test to prove your new feature is working.

Definition of Done

  • [ ] All of the required items are completed.
  • [ ] Approval by 1 mentor.

Estimation

[4] hours

paritoshsinghrahar avatar Aug 27 '20 13:08 paritoshsinghrahar

Hi,

I want to work on this one. please assign it to me.

ashokrayal avatar Aug 29 '20 16:08 ashokrayal

@Ashokrayal I have assigned you. I hope you have set up the environment and read community guidelines.

Happy Coding. :smiley:

paritoshsinghrahar avatar Sep 01 '20 10:09 paritoshsinghrahar

Thanks :) I will work on this on this Saturday. I can work on two issues over weekend, if assigned.

ashokrayal avatar Sep 02 '20 13:09 ashokrayal

@Ashokrayal We need to make it fair for everyone and can't give more than 1 atm. So that everyone gets a chance. You can always work on more. Additionally, remember:

Contributing guidelines After approval you must make continuous notes on your progress in the issue while working. If there is not at least one comment every 3 days, the maintainer can reassign the issue.

paritoshsinghrahar avatar Sep 03 '20 10:09 paritoshsinghrahar

@Ashokrayal how's the PR going?

vj-codes avatar Sep 07 '20 07:09 vj-codes

Hi. I had issues in setup. Now it looks good. Will work on it in the evening. Thanks

ashokrayal avatar Sep 07 '20 07:09 ashokrayal

Hi @paritoshsinghrahar, @vj-codes

Issue is resolved. Need to add one test case but 40 testcases are failing. All have similar error - sqlalchemy.exc.IntegrityError: (sqlite3.IntegrityError) UNIQUE constraint failed: users.email [SQL: 'INSERT INTO users (name, username, email, password_hash, registration_date, terms_and_conditions_checked, is_admin, is_email_verified, email_verification_date, current_mentorship_role, membership_status, bio, location, occupation, organization, slack_username, social_media_links, skills, interests, resume_url, photo_url, need_mentoring, available_to_mentor) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'] [parameters: ('Admin', 'admin_username', '[email protected]', 'pbkdf2:sha256:50000$kfp8Z0Hu$72615dd331fe905cf2cf24f2ab9afa72bb2914d6dbef95218e86ea462ccb059c', 1599496969.716998, 1, 0, 0, None, None, None, None, None, None, None, None, None, None, None, None, None, 0, 0)] (Background on this error at: http://sqlalche.me/e/gkpj)

ashokrayal avatar Sep 07 '20 16:09 ashokrayal

@Ashokrayal Can you describe the errors in more detail? Also, like what kind of changes you made to reach, here. First, make a PR, we can then resolve the test cases there. Where I'll be able to see changes in code.

paritoshsinghrahar avatar Sep 08 '20 12:09 paritoshsinghrahar

thanks @paritoshsinghrahar 👍 I got it all sorted out. I am checking the location using contains. So It will work like below. location=delhi

results

  • delhi
  • new delhi
  • xyzdelhi
  • delhiabc

ashokrayal avatar Sep 08 '20 16:09 ashokrayal

Oh okay. Your PR will be reviewed. You can move on to other issues. @Ashokrayal

paritoshsinghrahar avatar Sep 09 '20 16:09 paritoshsinghrahar

Hi, Is this issue resolved or still available?

vermastuti avatar Sep 24 '20 13:09 vermastuti

no @vermastuti it's not. PR is under review :)

ashokrayal avatar Sep 26 '20 04:09 ashokrayal

Hi @paritoshsinghrahar , @vj-codes, Can someone review this PR?

ashokrayal avatar Sep 26 '20 05:09 ashokrayal

@paritoshsinghrahar @isabelcosta @vj-codes @SanketDG Is this active and available for work?

NenadPantelic avatar Jan 17 '21 21:01 NenadPantelic

Putting on hold as the best approach is not decided yet

vj-codes avatar Feb 21 '21 11:02 vj-codes