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 #3446] Create database table for saved searches #3461

Merged

Conversation

mikehgrantsgov
Copy link
Collaborator

Summary

Fixes #3446

Time to review: 10 mins

Changes proposed

Add user saved search model
Add DB migration

Context for reviewers

This lays the groundwork for an API to save user searched.

Additional information

Generated table:
Screenshot 2025-01-08 at 11 21 58 AM

Copy link
Collaborator

@chouinar chouinar left a comment

Choose a reason for hiding this comment

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

FYI - when actually using this table, there might be some serialization issues as the default JSON serializer/deserializer probably won't handle things like python enums right.

We can adjust the serializer: https://github.com/HHS/simpler-grants-gov/blob/main/api/src/adapters/db/clients/postgres_client.py#L51 - however don't use the random pydantic one I have commented out - we might be able to make the logging one more generic: https://github.com/HHS/simpler-grants-gov/blob/main/api/src/logging/formatters.py#L51

api/src/db/models/user_models.py Outdated Show resolved Hide resolved
@mikehgrantsgov
Copy link
Collaborator Author

FYI - when actually using this table, there might be some serialization issues as the default JSON serializer/deserializer probably won't handle things like python enums right.

We can adjust the serializer: https://github.com/HHS/simpler-grants-gov/blob/main/api/src/adapters/db/clients/postgres_client.py#L51 - however don't use the random pydantic one I have commented out - we might be able to make the logging one more generic: https://github.com/HHS/simpler-grants-gov/blob/main/api/src/logging/formatters.py#L51

I'll be sure to add a test in the ticket for the GET API.

Copy link
Collaborator

@chouinar chouinar left a comment

Choose a reason for hiding this comment

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

LGTM!

@mikehgrantsgov mikehgrantsgov merged commit 061c558 into main Jan 8, 2025
2 checks passed
@mikehgrantsgov mikehgrantsgov deleted the mikehgrantsgov/3446-create-db-table-saved-search branch January 8, 2025 21:01
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.

Create database table for saved searches
3 participants