diff --git a/Notesnook.API/Accessors/SyncItemsRepositoryAccessor.cs b/Notesnook.API/Accessors/SyncItemsRepositoryAccessor.cs index 8f2a1ae..07933c7 100644 --- a/Notesnook.API/Accessors/SyncItemsRepositoryAccessor.cs +++ b/Notesnook.API/Accessors/SyncItemsRepositoryAccessor.cs @@ -32,7 +32,7 @@ namespace Notesnook.API.Accessors public SyncItemsRepository Relations { get; } public SyncItemsRepository Reminders { get; } public SyncItemsRepository Contents { get; } - public SyncItemsRepository Settings { get; } + public SyncItemsRepository LegacySettings { get; } public SyncItemsRepository Attachments { get; } public SyncItemsRepository Colors { get; } public SyncItemsRepository Tags { get; } @@ -42,7 +42,7 @@ namespace Notesnook.API.Accessors public SyncItemsRepositoryAccessor(SyncItemsRepository _notes, SyncItemsRepository _notebooks, SyncItemsRepository _content, - SyncItemsRepository _settings, + SyncItemsRepository _legacySettings, SyncItemsRepository _attachments, SyncItemsRepository _shortcuts, SyncItemsRepository _relations, @@ -56,6 +56,7 @@ namespace Notesnook.API.Accessors Notes = _notes; Contents = _content; Settings = _settings; + LegacySettings = _legacySettings; Attachments = _attachments; UsersSettings = _usersSettings; Monographs = _monographs; diff --git a/Notesnook.API/Hubs/SyncHub.cs b/Notesnook.API/Hubs/SyncHub.cs index 797755c..3eee83f 100644 --- a/Notesnook.API/Hubs/SyncHub.cs +++ b/Notesnook.API/Hubs/SyncHub.cs @@ -254,7 +254,7 @@ namespace Notesnook.API.Hubs var settings = JsonSerializer.Deserialize(data); settings.Id = MongoDB.Bson.ObjectId.Parse(userId); settings.ItemId = userId; - Repositories.Settings.Upsert(settings, userId, dateSynced); + Repositories.LegacySettings.Upsert(settings, userId, dateSynced); break; case "vaultKey": userSettings.VaultKey = JsonSerializer.Deserialize(data); @@ -339,7 +339,7 @@ namespace Notesnook.API.Hubs if (settings == null) return 0; settings.Id = MongoDB.Bson.ObjectId.Parse(userId); settings.ItemId = userId; - Repositories.Settings.Upsert(settings, userId, dateSynced); + Repositories.LegacySettings.Upsert(settings, userId, dateSynced); } else { @@ -464,7 +464,7 @@ namespace Notesnook.API.Hubs var chunks = PrepareChunks( collections: new[] { - Repositories.Settings.FindItemsSyncedAfter, + Repositories.LegacySettings.FindItemsSyncedAfter, Repositories.Attachments.FindItemsSyncedAfter, Repositories.Notes.FindItemsSyncedAfter, Repositories.Notebooks.FindItemsSyncedAfter, @@ -526,7 +526,7 @@ namespace Notesnook.API.Hubs Repositories.Notes.CountItemsSyncedAfterAsync(userId, lastSyncedTimestamp), Repositories.Notebooks.CountItemsSyncedAfterAsync(userId, lastSyncedTimestamp), Repositories.Contents.CountItemsSyncedAfterAsync(userId, lastSyncedTimestamp), - Repositories.Settings.CountItemsSyncedAfterAsync(userId, lastSyncedTimestamp), + Repositories.LegacySettings.CountItemsSyncedAfterAsync(userId, lastSyncedTimestamp), Repositories.Shortcuts.CountItemsSyncedAfterAsync(userId, lastSyncedTimestamp), Repositories.Reminders.CountItemsSyncedAfterAsync(userId, lastSyncedTimestamp), Repositories.Relations.CountItemsSyncedAfterAsync(userId, lastSyncedTimestamp), @@ -545,7 +545,7 @@ namespace Notesnook.API.Hubs } var collections = new[] { - Repositories.Settings.FindItemsSyncedAfter, + Repositories.LegacySettings.FindItemsSyncedAfter, Repositories.Attachments.FindItemsSyncedAfter, Repositories.Notes.FindItemsSyncedAfter, Repositories.Notebooks.FindItemsSyncedAfter, diff --git a/Notesnook.API/Interfaces/ISyncItemsRepositoryAccessor.cs b/Notesnook.API/Interfaces/ISyncItemsRepositoryAccessor.cs index ea4214f..2131e44 100644 --- a/Notesnook.API/Interfaces/ISyncItemsRepositoryAccessor.cs +++ b/Notesnook.API/Interfaces/ISyncItemsRepositoryAccessor.cs @@ -32,7 +32,7 @@ namespace Notesnook.API.Interfaces SyncItemsRepository Reminders { get; } SyncItemsRepository Relations { get; } SyncItemsRepository Contents { get; } - SyncItemsRepository Settings { get; } + SyncItemsRepository LegacySettings { get; } SyncItemsRepository Attachments { get; } SyncItemsRepository Colors { get; } SyncItemsRepository Tags { get; } diff --git a/Notesnook.API/Services/UserService.cs b/Notesnook.API/Services/UserService.cs index a255fdb..9e6e2a8 100644 --- a/Notesnook.API/Services/UserService.cs +++ b/Notesnook.API/Services/UserService.cs @@ -167,18 +167,7 @@ namespace Notesnook.API.Services { var cc = new CancellationTokenSource(); - Repositories.Notes.DeleteByUserId(userId); - Repositories.Notebooks.DeleteByUserId(userId); - Repositories.Shortcuts.DeleteByUserId(userId); - Repositories.Contents.DeleteByUserId(userId); - Repositories.Settings.DeleteByUserId(userId); - Repositories.Attachments.DeleteByUserId(userId); - Repositories.Reminders.DeleteByUserId(userId); - Repositories.Relations.DeleteByUserId(userId); - Repositories.Colors.DeleteByUserId(userId); - Repositories.Tags.DeleteByUserId(userId); - Repositories.UsersSettings.Delete((u) => u.UserId == userId); - Repositories.Monographs.DeleteMany((m) => m.UserId == userId); + Repositories.LegacySettings.DeleteByUserId(userId); if (!Constants.IS_SELF_HOSTED) { @@ -215,6 +204,7 @@ namespace Notesnook.API.Services Repositories.Shortcuts.DeleteByUserId(userId); Repositories.Contents.DeleteByUserId(userId); Repositories.Settings.DeleteByUserId(userId); + Repositories.LegacySettings.DeleteByUserId(userId); Repositories.Attachments.DeleteByUserId(userId); Repositories.Reminders.DeleteByUserId(userId); Repositories.Relations.DeleteByUserId(userId);