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

[Issue 605] Create a basic opportunity search endpoint #615

Merged
merged 23 commits into from
Oct 27, 2023

Conversation

chouinar
Copy link
Collaborator

Summary

Fixes #605 (Part 2/2)

This is built ontop of #613 and assumes that will be merged first.

Time to review: 15 mins

Changes proposed

Created a basic opportunity search endpoint with pagination

Added a few simple filters to the endpoint

Added a basic script to seed the local DB with opportunities

Context for reviewers

This adds the basic structure and implementation of an endpoint for querying for opportunities and filtering the results. Only a few fields are currently able to be filtered, but adding more is pretty straightforward.

I'm not sure of the best way to structure the tests, I think as we add more features to the endpoint + more fields, we'll likely adjust the structure of the tests. Went with a fairly straightforward approach at the moment.

Additional information

Running make db-seed-local will populate your local DB with 25 opportunities each time it runs.

Screenshot 2023-10-24 at 1 15 18 PM

Running make run-logs lets you run the API + see the logs. Going to http://localhost:8080/docs you can find the new opportunity endpoint which you can query and get results:
Screenshot 2023-10-24 at 1 17 11 PM
Screenshot 2023-10-24 at 1 17 20 PM

The basic logging from the template works:
Screenshot 2023-10-24 at 1 17 59 PM
ks:

@chouinar chouinar requested review from daphnegold and acouch October 24, 2023 17:20
Copy link
Contributor

@daphnegold daphnegold left a comment

Choose a reason for hiding this comment

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

I tested locally with Swagger UI and poked around the database. Looks wonderful! :shipit:

stmt = (
select(Opportunity)
.order_by(sort_fn(getattr(Opportunity, search_params.sorting.order_by)))
.order_by()
Copy link
Contributor

Choose a reason for hiding this comment

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

We talked about removing this extra order_by() before shipping, just a reminder

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added when I merged from main

Base automatically changed from chouinar/opportunity-tables to main October 27, 2023 20:33
@chouinar chouinar merged commit 7911275 into main Oct 27, 2023
@chouinar chouinar deleted the chouinar/opportunity-api branch October 27, 2023 20:46
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.

[Task]: Implement initial opportunities endpoint
4 participants