Skip to content

This pull request enhances the /orders API endpoint by improving its search capabilities, updating the response structure, and adding tests to ensure correct functionality. #82

Merged
goldlabelapps merged 2 commits intomasterfrom
staging
Apr 11, 2026

Conversation

@goldlabelapps
Copy link
Copy Markdown
Owner

The main changes include switching to a new search query parameter, expanding the searchable fields, and introducing automated tests for the endpoint.

API improvements:

  • Changed the search query parameter from search to s (with alias support) for clarity and consistency.
  • Expanded search functionality to allow case-insensitive, partial matches in the name, description, and categories fields.
  • Updated the API response to include a search object with the search string used, improving client-side clarity.

Testing:

  • Added new tests in tests/test_orders.py to verify the /orders endpoint, including checks for the response structure, correct handling of the search parameter, and validation of returned data fields.

Refactor GET /orders to accept an aliased query param `s` (instead of `search`) and perform a case-insensitive partial match against name, description, and categories. Builds SQL WHERE clauses using LOWER(... ) LIKE %s, constructs a single lowered wildcard param and extends the query params accordingly. Also includes the provided search string in the response under `search.searchStr` and removes extraneous blank lines and an outdated comment about non-existent first_name/last_name columns.
Add tests/tests_orders.py with pytest tests using FastAPI TestClient to exercise the /orders endpoint. Tests validate response structure (meta, pagination, data, search), ensure data is a list and contains expected item keys when present, assert meta fields (severity and title), and verify handling of the s search parameter. This helps catch regressions in paginated order reads and search behavior.
@goldlabelapps goldlabelapps added this to the Proof of Concept milestone Apr 11, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in Python Apr 11, 2026
@goldlabelapps goldlabelapps merged commit b807d24 into master Apr 11, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Python Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant