feat: implement categorized global search with RBAC

- Added /api/search endpoint with strict role-based data isolation.

- Created searchGlobal function in dataService.

- Refined header UI with an interactive, categorized search results dropdown.
This commit is contained in:
Cauê Faleiros
2026-03-09 15:25:12 -03:00
parent 000bc38712
commit c07967188a
3 changed files with 222 additions and 9 deletions

View File

@@ -17,6 +17,19 @@ const getHeaders = () => {
};
};
export const searchGlobal = async (query: string): Promise<{ members: User[], teams: any[], attendances: any[] }> => {
try {
const response = await fetch(`${API_URL}/search?q=${encodeURIComponent(query)}`, {
headers: getHeaders()
});
if (!response.ok) throw new Error('Search failed');
return await response.json();
} catch (error) {
console.error("API Error (searchGlobal):", error);
return { members: [], teams: [], attendances: [] };
}
};
export const getAttendances = async (tenantId: string, filter: DashboardFilter): Promise<Attendance[]> => {
try {
const params = new URLSearchParams();