refactor(session-synchronizer): update last scanned timestamp based on synchronization results

This commit is contained in:
Haileyesus
2026-04-29 11:35:59 +03:00
parent 805e283fb6
commit 10f35c238d
2 changed files with 13 additions and 5 deletions

View File

@@ -28,14 +28,15 @@ export const scanStateDb = {
return lastScannedDate;
},
updateLastScannedAt() {
updateLastScannedAt(scannedAt: Date = new Date()) {
const db = getConnection();
const sqliteTimestamp = scannedAt.toISOString().slice(0, 19).replace('T', ' ');
db.prepare(`
INSERT INTO scan_state (id, last_scanned_at)
VALUES (1, CURRENT_TIMESTAMP)
VALUES (1, ?)
ON CONFLICT (id)
DO UPDATE SET last_scanned_at = CURRENT_TIMESTAMP
`).run();
DO UPDATE SET last_scanned_at = excluded.last_scanned_at
`).run(sqliteTimestamp);
}
};