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 #3694] Add Sorting To Saved Opportunity #3846

Merged
merged 26 commits into from
Feb 20, 2025
Merged

Conversation

babebe
Copy link
Collaborator

@babebe babebe commented Feb 11, 2025

Summary

Fixes #{3694}

Time to review: 5 mins

Changes proposed

Updated route to POST endpoint to pass in pagination object
Added Input schema UserSavedOpportunitiesRequestSchema with pagination: can now sort with "created_at", "updated_at", "opportunity_title", "close_date" defaulting to agency_code
Updated service func get_saved_opportunities to implement the pagination and return also return pagination info
Updated Test

@babebe babebe added the draft Not yet ready for review label Feb 11, 2025
@babebe babebe linked an issue Feb 11, 2025 that may be closed by this pull request
3 tasks
elif order.sort_direction == SortDirection.DESCENDING:
order_col = desc(column)
if order.order_by == "close_date":
order_cols.append(order_col.nullslast())
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the type checking issues might be because of this confusing it.

I also think we want this to be nulls_last(order_col) based on: https://docs.sqlalchemy.org/en/20/core/sqlelement.html#sqlalchemy.sql.expression.nulls_last

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated

@babebe
Copy link
Collaborator Author

babebe commented Feb 12, 2025

@doug-s-nava Similar to saved search list endpoint endpoint for the user get saved opportunities endpoint , this will be updated to use the POST method /v1/users/<uuid:user_id>/saved-opportunities/list in order to accommodate the pagination request object.

@babebe babebe requested a review from chouinar February 12, 2025 17:52
@babebe babebe removed the draft Not yet ready for review label Feb 12, 2025
@doug-s-nava
Copy link
Collaborator

doug-s-nava commented Feb 12, 2025

@babebe got it. I guess we need a ticket to switch over our saved opportunities call?

@babebe
Copy link
Collaborator Author

babebe commented Feb 12, 2025

@babebe got it. I guess we need a ticket to switch over our saved opportunities call?

Yup, you're right

@chouinar
Copy link
Collaborator

@babebe - this change looks good, but want to be careful about merging it if it immediately breaks a feature the frontend is building. Can we work with Aaron/Doug to make sure they get changes in that might be needed?

@babebe
Copy link
Collaborator Author

babebe commented Feb 19, 2025

@babebe - this change looks good, but want to be careful about merging it if it immediately breaks a feature the frontend is building. Can we work with Aaron/Doug to make sure they get changes in that might be needed?

Talked to Aaron. I will be merging the backend, then the front-end changes will be merged in.

Copy link
Collaborator

@mdragon mdragon left a comment

Choose a reason for hiding this comment

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

Approved

@babebe babebe merged commit 8528994 into main Feb 20, 2025
@babebe babebe deleted the 3694/saved-opp-sorting branch February 20, 2025 14:48
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.

Adjust GET saved-opportunity endpoint to take in sorting/pagination and use it
5 participants