feat(search): add unified global search for users/chats/messages
Some checks failed
CI / test (push) Failing after 24s

This commit is contained in:
2026-03-08 09:41:20 +03:00
parent 76ab9c72f5
commit bc483afd78
8 changed files with 185 additions and 15 deletions

16
web/src/api/search.ts Normal file
View File

@@ -0,0 +1,16 @@
import { http } from "./http";
import type { DiscoverChat, Message, UserSearchItem } from "../chat/types";
export interface GlobalSearchResponse {
users: UserSearchItem[];
chats: DiscoverChat[];
messages: Message[];
}
export async function globalSearch(query: string): Promise<GlobalSearchResponse> {
const { data } = await http.get<GlobalSearchResponse>("/search", {
params: { query, users_limit: 10, chats_limit: 10, messages_limit: 10 }
});
return data;
}