refactor(application): replace ISender dispatch with direct IRepository usage in email handlers
- FetchEmailsQuery, MarkEmailAsSeenCommand, PublishEmailCommand: resolve EmailAccount via IRepository<EmailAccount> instead of dispatching GetEmailAccountQuery through ISender - Swap InvalidOperationException for BadRequestException when IMAP server is not configured - Add ILogger to handlers; warn when multiple accounts match the lookup criteria - EmailAccountsOptions.Accounts now typed as IEnumerable<EmailAccountModificationDto> instead of IEnumerable<EmailAccount> to decouple config from domain entity - EmailMappingProfile: add EmailAccount <-> EmailAccountDto/EmailAccountModificationDto maps
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
#if NET
|
||||
using DigitalData.MessagingService.Application.Common.Dto;
|
||||
using DigitalData.MessagingService.Application.Common.Dto.EmailAccounts;
|
||||
using DigitalData.MessagingService.Application.EmailAccounts.Commands;
|
||||
using DigitalData.MessagingService.Domain.Entities;
|
||||
|
||||
namespace DigitalData.MessagingService.Application.Common.Options;
|
||||
@@ -14,7 +17,7 @@ public class EmailAccountsOptions
|
||||
/// <summary>
|
||||
/// The list of configured email accounts.
|
||||
/// </summary>
|
||||
public required IEnumerable<EmailAccount> Accounts { get; init; } = [];
|
||||
public required IEnumerable<EmailAccountModificationDto> Accounts { get; init; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// How often the IMAP sync worker polls for new emails, in seconds.
|
||||
|
||||
Reference in New Issue
Block a user