Skip to content

Conversation

@ysiddhapura
Copy link
Contributor

@ysiddhapura ysiddhapura commented Apr 29, 2023

Donor Feature work in progress

Refer to #193

@ysiddhapura ysiddhapura added the feature New feature or request label Apr 29, 2023
@ysiddhapura ysiddhapura changed the title Reporting all donations by Donors, Issue #193 Reporting all donations by Donors Apr 29, 2023
@parthpandey1 parthpandey1 marked this pull request as ready for review May 1, 2023 08:01
@parthpandey1
Copy link
Contributor

Created a GET endpoint to fetch all users with at least one donation.
Steps to test:

  1. Pull from 'donorlookup' branch.
  2. docker-compose up
  3. curl http://localhost:3001/donors

Should return a JSON with person_id, full name and email of all donors.
Screenshot 2023-05-01 011112

@briswells
Copy link
Contributor

@parthpandey1 Code look awesome, and works correctly. Could you add authentication to the route. Just passing ensureAuthenticated as a route argument does not cause it to require authentication. You can look at the /feed route for an example.

@ysiddhapura ysiddhapura marked this pull request as draft May 1, 2023 16:47
@jayrevolinskyjr jayrevolinskyjr linked an issue May 1, 2023 that may be closed by this pull request
13 tasks
@jayrevolinskyjr jayrevolinskyjr changed the title Reporting all donations by Donors Donor Lookup and Add Donations on Checkout May 1, 2023
@parthpandey1 parthpandey1 requested review from Anoushka444, Jooms, briswells and jayrevolinskyjr and removed request for Jooms, briswells and jayrevolinskyjr May 2, 2023 08:40
@parthpandey1
Copy link
Contributor

Did the following as part of 1b38344 and 5181aab :

  1. Added an endpoint for donor lookup. This endpoint will return persons with at least one donation who match the description (first_name and/or last_name and/or id). Steps to test:
  • Pull from 'donorlookup' branch.
  • docker-compose up
  • Download and install postman.
  • Follow the instructions provided by @briswells on discord. After downloading postman create a collection, on the authorization tab under type select bearer token, then set Token to
    {{token}}
    after doing so select the pre-request script tab and paste the following code into it:
pm.sendRequest({
    url: 'localhost:3001/login',
    method: 'POST',
    header: {
        'content-type': 'application/json'
    },
    body: {
        mode: 'raw',
        raw: JSON.stringify({"email":"johndoe@example.com", "password":"password" })
    }
}, (err, res) => pm.collectionVariables.set("token", res.json().token));

and hit save.

After doing so you can click the 3 dots shown when highlighting your collection on the left, click Add Request and input values required for testing.

This completes the 2nd BE task in #193

Note: The first_name and last_name search parameters do not have to be exact (for example if dummy_data.sql is run, http://localhost:3001/lookupDonor?first_name=John and http://localhost:3001/lookupDonor?first_name=Joh will return the same result). However, person_id should be exact to return results.

  1. Added authentication to /donors endpoint as suggested by @briswells

@briswells
Copy link
Contributor

Looks great. Sorry I didn't notice this earlier but I would suggest is changing the names of the query parameters to be fname, and lname, just to keep everything consistent. You could also map the return dict so it returns data using the same dict keys that are being used for the API query parameter. Although this may cause confusion as different user routes might return the same fields named different things.

@jayrevolinskyjr jayrevolinskyjr marked this pull request as ready for review May 9, 2023 06:24
@jayrevolinskyjr
Copy link
Contributor

I've opened this PR for review since it has so much code and checks off 13 out of the 16 original subtasks. The remaining tasks are broken down into #232, #233, #234.

Heads-up to any code reviewers, there was a significant amount of UI edits merged to main that generated conflicts, resolving those conflicts generated code bloat in this branch.

@reembot reembot changed the title Donor Lookup and Add Donations on Checkout Donor Page View API + Frontend Add Donor + Donate Functionality May 10, 2023
@reembot reembot self-requested a review May 10, 2023 03:23
reembot
reembot previously approved these changes May 10, 2023
Copy link
Contributor

@reembot reembot left a comment

Choose a reason for hiding this comment

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

Live review performed with @ysiddhapura -
Reduced feature targets to mitigate PR bloat. New issues have been created for pending funtionality/features.

@Jooms Jooms mentioned this pull request May 10, 2023
Jooms
Jooms previously approved these changes May 10, 2023
Copy link
Contributor

@jayrevolinskyjr jayrevolinskyjr left a comment

Choose a reason for hiding this comment

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

Runs like a charm on my machine

@ysiddhapura ysiddhapura merged commit ddc26de into main May 10, 2023
@ysiddhapura ysiddhapura deleted the donorlookup branch May 10, 2023 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request Urgent Need everyone's attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Donor Lookup and Add Donation at Checkout

10 participants