mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-02-12 19:22:45 +00:00
monograph: add sync support (#39)
* monograph: add sync support * monograph: fix password field && improve syncing logic && fix delete endpoint * sync: get rid of unnecessary .ToList & ToListAsync * sync: AddIdsToAllDevices is no longer asynchronous * monograph: simplify and fix several bugs - we were sending the triggerSync event to all users instead of all devices - asynchronous methods did not have the `Async` suffix - we weren't properly replacing the deleted monograph * monograph: fix minor issues * fix publishing * don't return deleted monograph in monographs/:id endpoint * persist UserId when soft deleting monograph * monograph: check soft delete status in several endpoints --------- Co-authored-by: Abdullah Atta <abdullahatta@streetwriters.co>
This commit is contained in:
@@ -194,6 +194,21 @@ namespace Notesnook.API.Services
|
||||
}
|
||||
}
|
||||
|
||||
public void AddIdsToAllDevices(List<string> ids)
|
||||
{
|
||||
foreach (var id in ListDevices())
|
||||
{
|
||||
if (IsSyncReset(id)) return;
|
||||
lock (id)
|
||||
{
|
||||
if (!IsDeviceRegistered(id)) Directory.CreateDirectory(Path.Join(device.UserSyncDirectoryPath, id));
|
||||
|
||||
var oldIds = GetUnsyncedIds(id);
|
||||
File.WriteAllLinesAsync(Path.Join(device.UserSyncDirectoryPath, id, "unsynced"), ids.Union(oldIds));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterDevice()
|
||||
{
|
||||
lock (device.UserId)
|
||||
|
||||
Reference in New Issue
Block a user