-
Notifications
You must be signed in to change notification settings - Fork 16
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
Conversation
There was a problem hiding this 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!
stmt = ( | ||
select(Opportunity) | ||
.order_by(sort_fn(getattr(Opportunity, search_params.sorting.order_by))) | ||
.order_by() |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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.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:The basic logging from the template works:
ks: