feat(mobile): queue track reactions made offline and sync on reconnect (M5)

Likes and dislikes without a network are kept in a pending_reactions
table (last reaction per track wins) and sent when the connection
returns, instead of being rolled back. Downloaded track DTOs pick up the
new reaction so the offline wave and Downloads reflect it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mrleo1nidandClaude Opus 5.5 committed 2026-10-20 13:08:36 +03:00
1 parent be34ee5361
commit 756e915ff9
5 files changed
+74 -9

No files matched your search

+7 -1
View File
@@ -4,7 +4,7 @@ let db: Promise<SQLite.SQLiteDatabase> | null = null;
/**
* Локальная база офлайн-режима (docs/mobile.md#офлайн). `owner` — хэш «сервер + пользователь»:
* скачанное и неотправленные события одного аккаунта не видны другому.
* скачанное, неотправленные события и реакции одного аккаунта не видны другому.
*/
export function getDb(): Promise<SQLite.SQLiteDatabase> {
db ??= (async () => {
@@ -25,6 +25,12 @@ export function getDb(): Promise<SQLite.SQLiteDatabase> {
owner TEXT NOT NULL,
body TEXT NOT NULL
);
CREATE TABLE IF NOT EXISTS pending_reactions (
owner TEXT NOT NULL,
track_id TEXT NOT NULL,
reaction TEXT,
PRIMARY KEY (owner, track_id)
);
`);
return d;
})();