Skip to content

Implement global search#24

Open
Duhl-Liamz wants to merge 1 commit into
gitearn-io:mainfrom
Duhl-Liamz:codex/global-search
Open

Implement global search#24
Duhl-Liamz wants to merge 1 commit into
gitearn-io:mainfrom
Duhl-Liamz:codex/global-search

Conversation

@Duhl-Liamz
Copy link
Copy Markdown

@Duhl-Liamz Duhl-Liamz commented May 16, 2026

Closes #3

Implements a focused global search feature for the $5 issue.

Summary

  • Adds authenticated GET /api/v1/search/ for resources visible to the current user
  • Searches item title/description for regular users and also user email/full name for superusers
  • Returns a stable, paginated result list with a true total count
  • Adds a debounced navbar search dropdown with loading, empty, and error states
  • Adds backend coverage for superuser results, normal-user scoping, result limits/counts, and blank queries

Why this version

This takes the same basic direction as the existing open PR, but addresses the review concerns up front:

  • Debounces the navbar query and uses React Query cache timing instead of requesting on every keystroke
  • Orders database results by id descending so result ordering is deterministic
  • Makes count represent all matching records, not just the returned page
  • Avoids brittle exact-array assertions in the normal-user access test

Verification

  • python -m compileall backend\app
  • python -m alembic upgrade head
  • python -m pytest app\tests\api\routes\test_search.py -q (4 passed)
  • python -m pytest app\tests -q -k "not test_reset_password and not pre_start" (55 passed, 4 deselected)
  • python -m ruff check app
  • npm ci
  • npm run build
  • biome check --no-errors-on-unmatched --files-ignore-unknown=true src\components\Common\Navbar.tsx

Local setup used portable PostgreSQL 16 on localhost:5432 plus portable Node.js 20/npm for the frontend build.

Note: the unfiltered backend suite currently has unrelated baseline failures: test_reset_password changes the superuser password without restoring it, and two pre-start tests use called_once_with instead of assert_called_once_with.

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.

✨ Implment global search feature

1 participant