This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
forked from HHS/simpler-grants-gov
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Issue HHS#2039] Finish connecting new search parameters to backend q…
…ueries (#197) Fixes HHS#2039 Adjusted the logic that connects the API requests to the builder in the search layer to now connect all of the new fields. A few minor validation adjustments to the API to prevent a few common mistakes a user could make The length of the search tests are getting pretty long, I think a good follow-up would be to split the test file into validation and response testing. I adjusted some validation/setup of the API schemas because I don't see a scenario where min/max OR start/end dates would not ever be needed together. This also let me add a quick validation rule that a user would provide at least one of the values. I adjusted some of the way the search_opportunities file was structured as we only supported filtering by strings before, and it used the name of the variables to determine the type. I made it a bit more explicit, as before random variables could be passed through to the search layer which seems potentially problematic if not filtered out somewhere.
- Loading branch information
Showing
5 changed files
with
514 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from datetime import date | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
class StrSearchFilter(BaseModel): | ||
one_of: list[str] | None = None | ||
|
||
|
||
class BoolSearchFilter(BaseModel): | ||
one_of: list[bool] | None = None | ||
|
||
|
||
class IntSearchFilter(BaseModel): | ||
min: int | None = None | ||
max: int | None = None | ||
|
||
|
||
class DateSearchFilter(BaseModel): | ||
start_date: date | None = None | ||
end_date: date | None = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.