This commit is contained in:
2025-10-24 22:14:20 +02:00
parent 66ac428139
commit eede176e5e
10 changed files with 1176 additions and 59 deletions
View File
Binary file not shown.
+3 -2
View File
@@ -177,13 +177,14 @@ router.post('/sync', async (req: Request, res: Response) => {
transaction({ lastSyncTimestamp, lists, fields, items, itemValues });
// Get updates from server since last sync
// IMPORTANT: Get updates from server AFTER saving incoming data
// This ensures clients receive back any data they just sent (for confirmation)
// If lastSyncTimestamp is 0, get all data (initial sync)
// IMPORTANT: Include deleted items so clients can sync deletions
let serverLists, serverFields, serverItems, serverItemValues;
if (lastSyncTimestamp === 0) {
// Initial sync: send all non-deleted items
// Initial sync: send all non-deleted items (AFTER processing incoming data)
serverLists = db.prepare('SELECT * FROM lists WHERE isDeleted = 0').all();
serverFields = db.prepare('SELECT * FROM fields WHERE isDeleted = 0').all();
serverItems = db.prepare('SELECT * FROM items WHERE isDeleted = 0').all();