feat(application): register AutoMapper mappings for new commands and add SendAndAppend to IImapEmailService

This commit is contained in:
2026-08-17 10:15:13 +02:00
parent f7e95eb7f7
commit 822c7b1352
2 changed files with 19 additions and 0 deletions

View File

@@ -37,5 +37,14 @@ public interface IImapEmailService
/// <param name="folder"></param>
/// <returns></returns>
DateTime? GetLastImapSyncDate(int accountId, string folder = "INBOX");
/// <summary>
/// Sends an email via SMTP using the account credentials and appends the sent message
/// to the account's IMAP Sent Items folder.
/// </summary>
Task SendAndAppendAsync(
EmailContext context,
string sentFolder = "Sent",
CancellationToken cancellationToken = default);
}
#endif

View File

@@ -20,6 +20,16 @@ public class EmailMappingProfile : Profile
.ForMember(dest => dest.Sender, opt => opt.Ignore())
.ForMember(dest => dest.Attachments, opt => opt.MapFrom(src => src.Attachments));
// PublishEmailViaImapCommand -> EmailContext
CreateMap<PublishEmailViaImapCommand, EmailContext>()
.ForMember(dest => dest.Sender, opt => opt.Ignore())
.ForMember(dest => dest.Attachments, opt => opt.MapFrom(src => src.Attachments));
// PublishEmailViaOAuth2Command -> EmailContext
CreateMap<PublishEmailViaOAuth2Command, EmailContext>()
.ForMember(dest => dest.Sender, opt => opt.Ignore())
.ForMember(dest => dest.Attachments, opt => opt.MapFrom(src => src.Attachments));
// EmailAccountDto -> EmailAccount
CreateMap<EmailAccount, EmailAccountDto>();
CreateMap<EmailAccountModificationDto, EmailAccount>();