From 098ff637be59a955eadf882cef3b98460570ae8f Mon Sep 17 00:00:00 2001 From: Wei Zang Date: Wed, 8 Apr 2026 13:15:53 +0100 Subject: [PATCH] Bump version and add hideflagged query param Update package version to 2.1.7 and extend the get_prospects endpoint with a new boolean Query parameter `hideflagged` (default false). When true, the query adds `flag IS NOT TRUE` to the WHERE clause to exclude flagged records; existing search, pagination, and limits remain unchanged. This enables clients to optionally filter out flagged prospects. --- app/__init__.py | 2 +- app/api/prospects/prospects.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 5ffc4af..08a9ea4 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -1,4 +1,4 @@ """Python - FastAPI, Postgres, tsvector""" # Current Version -__version__ = "2.1.6" +__version__ = "2.1.7" diff --git a/app/api/prospects/prospects.py b/app/api/prospects/prospects.py index 353f83d..080e0af 100644 --- a/app/api/prospects/prospects.py +++ b/app/api/prospects/prospects.py @@ -13,7 +13,8 @@ def get_prospects( page: int = Query(1, ge=1, description="Page number (1-based)"), limit: int = Query(100, ge=1, le=500, description="Records per page (default 100, max 500)"), - search: str = Query(None, description="Search term for first or last name (case-insensitive, partial match)") + search: str = Query(None, description="Search term for first or last name (case-insensitive, partial match)"), + hideflagged: bool = Query(False, description="If true, flagged records are excluded") ) -> dict: """Return paginated, filtered, and ordered prospects (then alphabetical by first_name), filtered by search if provided.""" meta = make_meta("success", "Read paginated prospects") @@ -25,6 +26,8 @@ def get_prospects( # Build WHERE clause where_clauses = ["hide IS NOT TRUE"] params = [] + if hideflagged: + where_clauses.append("flag IS NOT TRUE") if search: where_clauses.append("(LOWER(first_name) LIKE %s OR LOWER(last_name) LIKE %s)") search_param = f"%{search.lower()}%"