perf(*): bound list queries, batch fetches, harden media downloads

This commit is contained in:
hh committed 2026-09-01 21:38:22 +02:00
1 parent 9c12628304
commit 1fa4f18a9b
35 files changed
+473 -138

No files matched your search

+18 -2
View File
@@ -303,8 +303,14 @@ export function getMessageLinks(
});
}
export function getChatCalendar(chatId: number): Promise<DayCount[]> {
return request<DayCount[]>(`/chats/${chatId}/calendar`, { account: true });
export function getChatCalendar(
chatId: number,
range: { date_from?: string; date_to?: string } = {}
): Promise<DayCount[]> {
return request<DayCount[]>(`/chats/${chatId}/calendar`, {
account: true,
query: { ...range },
});
}
export function getMessageAt(chatId: number, date: string): Promise<MessageAt> {
@@ -334,6 +340,16 @@ export function getPeers(ids: number[]): Promise<PeerView[]> {
});
}
export function getChatsBatch(ids: number[]): Promise<Chat[]> {
if (ids.length === 0) {
return Promise.resolve([]);
}
return request<Chat[]>("/chats/batch", {
account: true,
query: { ids: ids.join(",") },
});
}
export function enrichChat(chatId: number): Promise<{ job_id: number }> {
return request<{ job_id: number }>(`/chats/${chatId}/enrich`, {
method: "POST",