Refactor email search with new filter models

Replaced the old `SearchFilter` with the new `MailSearchFilter` model to enable more flexible and granular email search criteria. Introduced `DateFilter`, `UidFilter`, and `MailSortOrder` to support advanced filtering options such as date ranges, UID ranges, and sorting order. Updated `IImapEmailService` and `FetchEmailsQuery` to use the new models.

Added validators (`DateFilterValidator`, `MailSearchFilterValidator`, `UidFilterValidator`) to ensure input correctness. Refactored `LimilabsImapEmailService` to dynamically construct IMAP search queries based on the new filter properties, supporting unseen messages, text filters, and client-side attachment filtering.

Improved maintainability and scalability by cleaning up redundant code and leveraging the new models and validation framework.
This commit is contained in:
2026-08-07 14:52:28 +02:00
parent 53ba40b316
commit 8e2e9af451
11 changed files with 346 additions and 35 deletions

View File

@@ -1,4 +1,5 @@
using DigitalData.MessagingService.Abstraction;
using DigitalData.MessagingService.Application.Common.Models.MailSearch;
namespace DigitalData.MessagingService.Application.Common.Interfaces;
@@ -15,7 +16,7 @@ public interface IImapEmailService
/// <param name="cancellationToken">Cancellation token.</param>
Task<IEnumerable<ReceivedEmailContext>> FetchEmailsAsync(
EmailAccountDto account,
FetchEmailsQuery.SearchFilter filter,
MailSearchFilter filter,
CancellationToken cancellationToken = default);
/// <summary>