mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-02-12 19:22:45 +00:00
sync: add new repositories for vault & settings
This commit is contained in:
@@ -33,8 +33,10 @@ namespace Notesnook.API.Accessors
|
||||
public SyncItemsRepository<Reminder> Reminders { get; }
|
||||
public SyncItemsRepository<Content> Contents { get; }
|
||||
public SyncItemsRepository<Setting> LegacySettings { get; }
|
||||
public SyncItemsRepository<SettingItem> Settings { get; }
|
||||
public SyncItemsRepository<Attachment> Attachments { get; }
|
||||
public SyncItemsRepository<Color> Colors { get; }
|
||||
public SyncItemsRepository<Vault> Vaults { get; }
|
||||
public SyncItemsRepository<Tag> Tags { get; }
|
||||
public Repository<UserSettings> UsersSettings { get; }
|
||||
public Repository<Monograph> Monographs { get; }
|
||||
@@ -43,11 +45,13 @@ namespace Notesnook.API.Accessors
|
||||
SyncItemsRepository<Notebook> _notebooks,
|
||||
SyncItemsRepository<Content> _content,
|
||||
SyncItemsRepository<Setting> _legacySettings,
|
||||
SyncItemsRepository<SettingItem> _settings,
|
||||
SyncItemsRepository<Attachment> _attachments,
|
||||
SyncItemsRepository<Shortcut> _shortcuts,
|
||||
SyncItemsRepository<Relation> _relations,
|
||||
SyncItemsRepository<Reminder> _reminders,
|
||||
SyncItemsRepository<Color> _colors,
|
||||
SyncItemsRepository<Vault> _vaults,
|
||||
SyncItemsRepository<Tag> _tags,
|
||||
Repository<UserSettings> _usersSettings,
|
||||
Repository<Monograph> _monographs)
|
||||
@@ -64,6 +68,7 @@ namespace Notesnook.API.Accessors
|
||||
Reminders = _reminders;
|
||||
Relations = _relations;
|
||||
Colors = _colors;
|
||||
Vaults = _vaults;
|
||||
Tags = _tags;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,9 @@ namespace Notesnook.API.Interfaces
|
||||
SyncItemsRepository<Content> Contents { get; }
|
||||
SyncItemsRepository<Setting> LegacySettings { get; }
|
||||
SyncItemsRepository<Attachment> Attachments { get; }
|
||||
SyncItemsRepository<SettingItem> Settings { get; }
|
||||
SyncItemsRepository<Color> Colors { get; }
|
||||
SyncItemsRepository<Vault> Vaults { get; }
|
||||
SyncItemsRepository<Tag> Tags { get; }
|
||||
Repository<UserSettings> UsersSettings { get; }
|
||||
Repository<Monograph> Monographs { get; }
|
||||
|
||||
@@ -110,6 +110,9 @@ namespace Notesnook.API.Models
|
||||
} = Algorithms.Default;
|
||||
}
|
||||
|
||||
[MessagePack.MessagePackObject]
|
||||
public class SettingItem : SyncItem { }
|
||||
|
||||
[MessagePack.MessagePackObject]
|
||||
public class Attachment : SyncItem { }
|
||||
|
||||
@@ -139,4 +142,7 @@ namespace Notesnook.API.Models
|
||||
|
||||
[MessagePack.MessagePackObject]
|
||||
public class Color : SyncItem { }
|
||||
|
||||
[MessagePack.MessagePackObject]
|
||||
public class Vault : SyncItem { }
|
||||
}
|
||||
|
||||
@@ -167,7 +167,9 @@ namespace Notesnook.API.Services
|
||||
{
|
||||
var cc = new CancellationTokenSource();
|
||||
|
||||
Repositories.Settings.DeleteByUserId(userId);
|
||||
Repositories.LegacySettings.DeleteByUserId(userId);
|
||||
Repositories.Vaults.DeleteByUserId(userId);
|
||||
|
||||
if (!Constants.IS_SELF_HOSTED)
|
||||
{
|
||||
@@ -210,6 +212,7 @@ namespace Notesnook.API.Services
|
||||
Repositories.Relations.DeleteByUserId(userId);
|
||||
Repositories.Colors.DeleteByUserId(userId);
|
||||
Repositories.Tags.DeleteByUserId(userId);
|
||||
Repositories.Vaults.DeleteByUserId(userId);
|
||||
Repositories.Monographs.DeleteMany((m) => m.UserId == userId);
|
||||
if (!await unit.Commit()) return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user