Skip to content

feat: implement global search API functionality#491

Merged
codeZe-us merged 24 commits into
SafeVault:devfrom
Oluwasuyi-Timilehin:feature/476-global-search-api
May 30, 2026
Merged

feat: implement global search API functionality#491
codeZe-us merged 24 commits into
SafeVault:devfrom
Oluwasuyi-Timilehin:feature/476-global-search-api

Conversation

@Oluwasuyi-Timilehin
Copy link
Copy Markdown

#closes #476

Summary

This pull request adds a new global search API endpoint to the dashboard. The endpoint searches across employees, invoices, and fiat transactions concurrently and returns a categorized JSON response.

Files Added

  • src/server/services/search.service.ts
  • src/app/api/v1/dashboard/search/route.ts

What Changed

  • Added SearchService.globalSearch() to perform concurrent database queries using Promise.all.
  • Implemented case-insensitive matching for:
    • Employee first and last names
    • Invoice numbers
    • Transaction reference and provider reference values
  • Added GET /api/v1/dashboard/search?q={query}
  • Added authentication enforcement via AuthUtils.authenticateRequest().
  • Returned structured categories: employees, invoices, and transactions.

Testing Steps

  1. Install dependencies if needed:
    corepack pnpm install
  2. Run the app in development mode:
    corepack pnpm dev
  3. Send a request to the new endpoint with a valid Bearer token:
    curl "http://localhost:3000/api/v1/dashboard/search?q=alice" \
      -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
  4. Confirm the response includes:
    • success: true
    • data.employees
    • data.invoices
    • data.transactions
  5. Validate search behavior:
    • Search by employee name returns employee results
    • Search by invoice number returns invoice results
    • Search by transaction reference returns transaction results
  6. Confirm invalid or missing q returns an error response.

Notes

  • The endpoint uses a maximum limit of 10 results per category.
  • If the authenticated user has no organizationId, the endpoint returns empty categories.

#closes

@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

@Oluwasuyi-Timilehin is attempting to deploy a commit to the vestroll's projects Team on Vercel.

A member of the Team first needs to authorize it.

@codeZe-us codeZe-us self-requested a review May 29, 2026 10:57
Copy link
Copy Markdown
Contributor

@codeZe-us codeZe-us left a comment

Choose a reason for hiding this comment

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

@Oluwasuyi-Timilehin PR should point to dev branch not main branch

@Oluwasuyi-Timilehin Oluwasuyi-Timilehin changed the base branch from main to dev May 29, 2026 14:47
@Oluwasuyi-Timilehin
Copy link
Copy Markdown
Author

@codeZe-us I already pointed the pr to the dev branch

@codeZe-us codeZe-us merged commit 1f3a2ad into SafeVault:dev May 30, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Global Search API

3 participants