Refactor: Replace EmailAttachmentContext with DTO
Replaced `EmailAttachmentContext` with `EmailAttachmentDto` across the codebase to align with the updated DTO naming convention. - Renamed `EmailAttachmentContext` to `EmailAttachmentDto`. - Updated property types, method signatures, and return types to use `EmailAttachmentDto`. - Modified XML documentation references to reflect the new class name. - Updated `ReceivedEmailContext` to `ReceivedEmailDto` and adjusted related methods and properties. - Refactored `FetchEmailsAsync` methods and handlers to use `ReceivedEmailDto`. - Adjusted `BuildAttachmentsAsync` and attachment handling logic in `EmailController` and `LimilabsImapEmailService`. This refactor ensures consistency and improves code clarity while maintaining functionality.
This commit is contained in:
@@ -10,7 +10,7 @@ namespace DigitalData.MessagingService.Application.EmailReceiving.Queries;
|
||||
/// <summary>
|
||||
/// Query to fetch emails from an IMAP mailbox.
|
||||
/// </summary>
|
||||
public record FetchEmailsQuery : IRequest<IEnumerable<ReceivedEmailContext>>
|
||||
public record FetchEmailsQuery : IRequest<IEnumerable<ReceivedEmailDto>>
|
||||
{
|
||||
/// <summary>
|
||||
/// Identifies the email account to use.
|
||||
@@ -25,9 +25,9 @@ public record FetchEmailsQuery : IRequest<IEnumerable<ReceivedEmailContext>>
|
||||
|
||||
public class FetchEmailsQueryHandler(
|
||||
ISender Sender,
|
||||
IImapEmailService ImapService) : IRequestHandler<FetchEmailsQuery, IEnumerable<ReceivedEmailContext>>
|
||||
IImapEmailService ImapService) : IRequestHandler<FetchEmailsQuery, IEnumerable<ReceivedEmailDto>>
|
||||
{
|
||||
public async Task<IEnumerable<ReceivedEmailContext>> Handle(FetchEmailsQuery request, CancellationToken cancellationToken)
|
||||
public async Task<IEnumerable<ReceivedEmailDto>> Handle(FetchEmailsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
var account = await Sender.Send(request.Account, cancellationToken)
|
||||
?? throw new NotFoundException(
|
||||
|
||||
Reference in New Issue
Block a user