diff --git a/Wino.Core.Domain/Interfaces/ICalendarService.cs b/Wino.Core.Domain/Interfaces/ICalendarService.cs index 73750110..b0e7d0c1 100644 --- a/Wino.Core.Domain/Interfaces/ICalendarService.cs +++ b/Wino.Core.Domain/Interfaces/ICalendarService.cs @@ -12,6 +12,7 @@ public interface ICalendarService Task> GetAccountCalendarsAsync(Guid accountId); Task GetAccountCalendarAsync(Guid accountCalendarId); Task DeleteCalendarItemAsync(Guid calendarItemId); + Task DeleteCalendarItemAsync(string calendarRemoteEventId, Guid calendarId); Task DeleteAccountCalendarAsync(AccountCalendar accountCalendar); Task InsertAccountCalendarAsync(AccountCalendar accountCalendar); diff --git a/Wino.Core/Integration/Processors/DefaultChangeProcessor.cs b/Wino.Core/Integration/Processors/DefaultChangeProcessor.cs index a7a98ea3..3c142f3e 100644 --- a/Wino.Core/Integration/Processors/DefaultChangeProcessor.cs +++ b/Wino.Core/Integration/Processors/DefaultChangeProcessor.cs @@ -44,6 +44,7 @@ public interface IDefaultChangeProcessor Task> GetAccountCalendarsAsync(Guid accountId); Task DeleteCalendarItemAsync(Guid calendarItemId); + Task DeleteCalendarItemAsync(string calendarRemoteEventId, Guid calendarId); Task DeleteAccountCalendarAsync(AccountCalendar accountCalendar); Task InsertAccountCalendarAsync(AccountCalendar accountCalendar); @@ -188,6 +189,9 @@ public class DefaultChangeProcessor(IDatabaseService databaseService, public Task DeleteCalendarItemAsync(Guid calendarItemId) => CalendarService.DeleteCalendarItemAsync(calendarItemId); + public Task DeleteCalendarItemAsync(string calendarRemoteEventId, Guid calendarId) + => CalendarService.DeleteCalendarItemAsync(calendarRemoteEventId, calendarId); + public Task DeleteAccountCalendarAsync(AccountCalendar accountCalendar) => CalendarService.DeleteAccountCalendarAsync(accountCalendar); diff --git a/Wino.Core/Synchronizers/OutlookSynchronizer.cs b/Wino.Core/Synchronizers/OutlookSynchronizer.cs index 687b6733..eb9659c7 100644 --- a/Wino.Core/Synchronizers/OutlookSynchronizer.cs +++ b/Wino.Core/Synchronizers/OutlookSynchronizer.cs @@ -49,8 +49,6 @@ namespace Wino.Core.Synchronizers.Mail; [JsonSerializable(typeof(OutlookFileAttachment))] public partial class OutlookSynchronizerJsonContext : JsonSerializerContext; - - /// /// Outlook synchronizer implementation with delta token synchronization. /// @@ -102,6 +100,7 @@ public class OutlookSynchronizer : WinoSynchronizer(); private readonly IOutlookChangeProcessor _outlookChangeProcessor; @@ -1633,8 +1632,8 @@ public class OutlookSynchronizer : WinoSynchronizer { @@ -1691,18 +1690,44 @@ public class OutlookSynchronizer : WinoSynchronizer( + "SELECT * FROM CalendarItem WHERE CalendarId = ? AND RemoteEventId = ?", + calendarId, calendarRemoteEventId); + + if (calendarItem == null) return; + + await DeleteCalendarItemAsync(calendarItem.Id); + } + public async Task CreateNewCalendarItemAsync(CalendarItem calendarItem, List attendees) { try