refactor(gmail): route message import through IEmailProvider #9

Merged
cesnimda merged 1 commits from feat/gmail-provider-contract into main 2026-07-11 13:26:21 +02:00
+4 -4
View File
@@ -951,9 +951,9 @@ public sealed class GmailController : ControllerBase
private async Task<Correspondence> ImportSingleMessageAsync(string ownerUserId, JobApplication job, string messageId, CancellationToken cancellationToken)
{
var detail = await _gmail.GetMessageAsync(ownerUserId, messageId, cancellationToken);
var me = await _gmail.GetConnectionAsync(ownerUserId, cancellationToken);
var gmailAddress = me?.GmailAddress ?? string.Empty;
var detail = await Email.GetMessageAsync(ownerUserId, messageId, cancellationToken);
var me = await Email.GetConnectionAsync(ownerUserId, cancellationToken);
var gmailAddress = me?.Address ?? string.Empty;
var isMe = detail.From.Contains(gmailAddress, StringComparison.OrdinalIgnoreCase);
var messageDate = detail.Date?.LocalDateTime ?? DateTime.Now;
@@ -974,7 +974,7 @@ public sealed class GmailController : ControllerBase
FileName = attachment.FileName,
MimeType = attachment.MimeType,
SizeBytes = attachment.SizeBytes,
GmailAttachmentId = attachment.GmailAttachmentId,
GmailAttachmentId = attachment.ExternalAttachmentId,
Inline = attachment.Inline,
})),
Content = string.IsNullOrWhiteSpace(detail.BodyText) ? detail.Snippet : detail.BodyText,