Improve direct message history and SQLite resilience

This commit is contained in:
AidarKC
2026-07-22 13:09:42 +04:00
parent 2f3b1571e5
commit 93673e5786
18 changed files with 908 additions and 233 deletions
+17
View File
@@ -2579,6 +2579,23 @@ export class AuthService {
};
}
async getDirectMessages({ peerLogin, limit = 50, beforeTimeMs = 0, beforeMessageKey = '' } = {}) {
const payload = {
peerLogin: String(peerLogin || '').trim(),
limit: Number(limit || 0),
};
if (!payload.peerLogin) throw new Error('Не передан peerLogin');
if (Number.isFinite(Number(beforeTimeMs)) && Number(beforeTimeMs) > 0) {
payload.beforeTimeMs = Math.trunc(Number(beforeTimeMs));
}
if (String(beforeMessageKey || '').trim()) {
payload.beforeMessageKey = String(beforeMessageKey || '').trim();
}
const response = await this.ws.request('GetDirectMessages', payload);
if (response.status !== 200) throw opError('GetDirectMessages', response);
return response.payload || {};
}
async ackSessionDelivery(messageKey) {
const response = await this.ws.request('AckSessionDelivery', { messageKey });
if (response.status !== 200) throw opError('AckSessionDelivery', response);