feat(search): cross-entity tenant-scoped /api/v1/search endpoint (MAPPS-298) #332
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
psa-systems/mokosh-server!332
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/MAPPS-298-global-search-endpoint"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A new
searchmodule exposesGET /api/v1/search?q=<text>that runs an ILIKE per principal entity table (tickets / contacts / companies / assets / projects), tenant-scopes every query, and returns a grouped envelope with the top 5 matches per kind plus a true count so the SPA can render "more results" affordances when the per-section cap clips.Per-entity SQL details:
title,ticket_number, ordescription; secondary line is the linked company name.first_name,last_name, oremail; secondary is the linked company.name; secondary isindustry.name,serial_number, orasset_tag; secondary is the linked company, falling back to the serial.name; secondary is the linked company.The handler is
RequireAuth-gated (any authenticated tenant member can search) but the service tenant-scopes every query so users only see their own tenant's data. Per-entity permission boundaries (e.g.RequireFinanceon contracts) are deliberately NOT applied to the search preview - clicking through goes to the entity's normal detail page which enforces its own access. Query string is trimmed, capped at 200 chars (matchesqcaps on other filters), and SQL-LIKE wildcards (%,_,\) are escaped so user-typed special chars match literally.The client-side
<GlobalSearch>top-bar component lands in a sibling PR on mokosh-apps; the SPA fans out one call here per debounced keystroke.#MAPPS-298