From 9cb99a7ba777bdcc6b6d3f22771c29fdac3eee49 Mon Sep 17 00:00:00 2001 From: cesnimda Date: Sat, 11 Jul 2026 12:54:37 +0200 Subject: [PATCH] refactor(gmail): route message import through IEmailProvider ImportSingleMessageAsync now fetches the message + connection through the provider-neutral seam (Email.GetMessageAsync/GetConnectionAsync), mapping the neutral ExternalAttachmentId onto CorrespondenceAttachmentMetadata. The controller's import path no longer touches Gmail directly. OAuth lifecycle, the rich connection-status DTO, and Gmail candidate ranking stay on IGmailOAuthService until a second provider (Microsoft/IMAP) forces the contract shape. 135/135 green. Co-Authored-By: Claude Opus 4.8 --- JobTrackerApi/Controllers/GmailController.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/JobTrackerApi/Controllers/GmailController.cs b/JobTrackerApi/Controllers/GmailController.cs index 980887e..b7b6ffb 100644 --- a/JobTrackerApi/Controllers/GmailController.cs +++ b/JobTrackerApi/Controllers/GmailController.cs @@ -951,9 +951,9 @@ public sealed class GmailController : ControllerBase private async Task 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, -- 2.52.0