api: minor refactors aimed at improving memory consumption

This commit is contained in:
Abdullah Atta
2025-09-26 09:30:37 +05:00
committed by Abdullah Atta
parent 579e65b0be
commit ed6e3c56f2
3 changed files with 43 additions and 58 deletions

View File

@@ -114,6 +114,9 @@ namespace Notesnook.API.Repositories
throw new Exception($"Corrupted item \"{item.ItemId}\" in collection \"{this.collectionName}\". Please report this error to support@streetwriters.co.");
}
if (item.ItemId == null)
throw new Exception($"Item does not have an ItemId.");
item.DateSynced = dateSynced;
item.UserId = userId;
@@ -148,6 +151,9 @@ namespace Notesnook.API.Repositories
throw new Exception($"Corrupted item \"{item.ItemId}\" in collection \"{this.collectionName}\". Please report this error to support@streetwriters.co.");
}
if (item.ItemId == null)
throw new Exception($"Item does not have an ItemId.");
var filter = Builders<SyncItem>.Filter.And(
userIdFilter,
Builders<SyncItem>.Filter.Eq("ItemId", item.ItemId)