From f6e94e89c958455c8f5f64e115e17d512f6c7ae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Kaan=20K=C3=B6se?= Date: Thu, 25 Dec 2025 17:21:23 +0100 Subject: [PATCH] Fixing an issue where DeleteAsync calls expect PK. --- Wino.Services/AccountService.cs | 6 +++--- Wino.Services/CalendarService.cs | 2 +- Wino.Services/ContactService.cs | 2 +- Wino.Services/FolderService.cs | 2 +- Wino.Services/MailService.cs | 2 +- Wino.Services/SignatureService.cs | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Wino.Services/AccountService.cs b/Wino.Services/AccountService.cs index c7ccac9f..be003883 100644 --- a/Wino.Services/AccountService.cs +++ b/Wino.Services/AccountService.cs @@ -83,7 +83,7 @@ public class AccountService : BaseDatabaseService, IAccountService } await Connection.ExecuteAsync("UPDATE MailAccount SET MergedInboxId = NULL WHERE MergedInboxId = ?", mergedInboxId).ConfigureAwait(false); - await Connection.DeleteAsync(mergedInbox).ConfigureAwait(false); + await Connection.DeleteAsync(mergedInbox.Id).ConfigureAwait(false); // Change the startup entity id if it was the merged inbox. // Take the first account as startup account. @@ -290,9 +290,9 @@ public class AccountService : BaseDatabaseService, IAccountService await Connection.Table().DeleteAsync(a => a.AccountId == account.Id); if (account.Preferences != null) - await Connection.DeleteAsync(account.Preferences); + await Connection.DeleteAsync(account.Preferences.Id); - await Connection.DeleteAsync(account); + await Connection.DeleteAsync(account.Id); await _mimeFileService.DeleteUserMimeCacheAsync(account.Id).ConfigureAwait(false); diff --git a/Wino.Services/CalendarService.cs b/Wino.Services/CalendarService.cs index bc8d51a8..328bb5c2 100644 --- a/Wino.Services/CalendarService.cs +++ b/Wino.Services/CalendarService.cs @@ -45,7 +45,7 @@ public class CalendarService : BaseDatabaseService, ICalendarService await Connection.ExecuteAsync( "DELETE FROM CalendarItem WHERE CalendarId = ? AND AccountId = ?", accountCalendar.Id, accountCalendar.AccountId); - await Connection.DeleteAsync(accountCalendar); + await Connection.DeleteAsync(accountCalendar.Id); WeakReferenceMessenger.Default.Send(new CalendarListDeleted(accountCalendar)); } diff --git a/Wino.Services/ContactService.cs b/Wino.Services/ContactService.cs index cd765165..de52d3e5 100644 --- a/Wino.Services/ContactService.cs +++ b/Wino.Services/ContactService.cs @@ -97,7 +97,7 @@ public class ContactService : BaseDatabaseService, IContactService if (contact != null && !contact.IsRootContact) { - await Connection.DeleteAsync(contact).ConfigureAwait(false); + await Connection.DeleteAsync(contact.Address).ConfigureAwait(false); } } diff --git a/Wino.Services/FolderService.cs b/Wino.Services/FolderService.cs index f7266712..5f2f7e6c 100644 --- a/Wino.Services/FolderService.cs +++ b/Wino.Services/FolderService.cs @@ -508,7 +508,7 @@ public class FolderService : BaseDatabaseService, IFolderService _logger.Debug("Deleting folder {FolderName}", folder.FolderName); - await Connection.DeleteAsync(folder).ConfigureAwait(false); + await Connection.DeleteAsync(folder.Id).ConfigureAwait(false); // Delete all existing mails from this folder. await Connection.ExecuteAsync("DELETE FROM MailCopy WHERE FolderId = ?", folder.Id); diff --git a/Wino.Services/MailService.cs b/Wino.Services/MailService.cs index 09726ddc..6a1e3008 100644 --- a/Wino.Services/MailService.cs +++ b/Wino.Services/MailService.cs @@ -557,7 +557,7 @@ public class MailService : BaseDatabaseService, IMailService _logger.Debug("Deleting mail {Id} from folder {FolderName}", mailCopy.Id, mailCopy.AssignedFolder.FolderName); - await Connection.DeleteAsync(mailCopy).ConfigureAwait(false); + await Connection.DeleteAsync(mailCopy.UniqueId).ConfigureAwait(false); // If there are no more copies exists of the same mail, delete the MIME file as well. var isMailExists = await IsMailExistsAsync(mailCopy.Id).ConfigureAwait(false); diff --git a/Wino.Services/SignatureService.cs b/Wino.Services/SignatureService.cs index d6ceb6ff..ee17d190 100644 --- a/Wino.Services/SignatureService.cs +++ b/Wino.Services/SignatureService.cs @@ -50,7 +50,7 @@ public class SignatureService(IDatabaseService databaseService) : BaseDatabaseSe public async Task DeleteSignatureAsync(AccountSignature signature) { - await Connection.DeleteAsync(signature); + await Connection.DeleteAsync(signature.Id); return signature; }